Excellent, thank you.
Closed this issue · 1 comments
Just dropping by to say thank you for an excellent library. Source code is clear and idiomatic from a targetted Go/Linux/RPI system perspective. The README gives a nice introduction and justification.
I refactored my code from @hybridgroup's Gobot GPIO ButtonDriver to use your library instead and saw a significant reduction in resource consumption.
Below stats from top
are enough to see the huge difference during a non-eventful watch period.
Before:
RES SHR S %CPU %MEM
7432 2416 S 4.7 1.7
After:
RES SHR S %CPU %MEM
2404 1964 S 0.0 0.5
I actually had to hunt for the pid because the process no longer shows up in top when ordered by CPU usage. Nice work!
I'm assuming Gobot uses a polled approach, so the benefit you are seeing is due to the change to an interrupt driven approach - it isn't as though my library is doing anything magical.
Glad that the library is working for you, but as one of the kernel interfaces it uses is deprecated you might want to consider switching to my gpiod (github.com/warthog618/gpiod) library that uses the latest kernel GPIO character device interface. I'd be interested to know what you think of its API compared to this one.
Cheers,
Kent.