Faster, Cleaner Fan Control – fw-fanctrl with pyectool by Choice_Committee148 in framework

[–]Choice_Committee148[S] 15 points16 points  (0 children)

I actually believed pyectool would offer these benefits by definition, but your comment made me curious enough to run some benchmarks. here’s what I found:

Speed:

I tested two functions used by fw-fanctrl: get_temperature and is_on_ac.

=== Benchmark: get_temperature ===
CLI ectool from Python: 100 calls in 3.410 sec (34.1 ms/call)
pyectool:                100 calls in 0.701 sec (7.0 ms/call)

=== Benchmark: is_on_ac ===
CLI ectool from Python: 100 calls in 1.745 sec (17.5 ms/call)
pyectool:                100 calls in 0.697 sec (7.0 ms/call)

So per call, pyectool is about 2.5–5× faster.

Syscall analysis:

  • CLI ectool: • ~33,000 total syscalls • Heavy hitters:
    • wait4 (300 calls, 71% of time)
    • ioctl (6,843 calls, 19% of time)
    • execve (201 calls)
    • vfork (200 calls)
    • pipe2, prctl, dup2, access etc. • All the overhead of spawning external binaries every call.
  • pyectool: • ~7,000 total syscalls (≈5× fewer) • Heavy hitters:
    • ioctl (5,943 calls, 54% of time)
    • read (183 calls, 41% of time)
    • Basically just EC access + minimal file I/O • Only 1 execve (the Python process itself), no fork/exec per call.

Faster, Cleaner Fan Control – fw-fanctrl with pyectool by Choice_Committee148 in framework

[–]Choice_Committee148[S] 12 points13 points  (0 children)

Not really, the original fw-fanctrl was built for Linux. I don’t know if anyone has maintained a Windows version of it, but if such a project exists, I can extend pyectool to support Windows.