iberianpig / fusuma

Multitouch gestures with libinput driver on Linux
MIT License
3.58k stars 146 forks source link

Optimize merge #303

Closed ces42 closed 10 months ago

ces42 commented 11 months ago

This PR tries to make the merge() step in the pipeline more efficient (and also the execute() step a bit).

The most drastic (and functional) change is that I tried removing the condition-mechanism in Searcher. It seems to me like we might as well always "use :skip"? In that case the searcher will try to avoid skipping anyway and only skip if necessary. The only effect of the condition-mechanism is that if we don't skip when find_execute_key() is called in Runner.merge() then we're not allowed to skip in Runner.execute(). I can't actually come up with a situation where this would be the case.

Benchmark: I ran 20000.times { pipeline } with both versions, feeding them touchpad events that I had recorded for a couple of hours. The results show a ~10% speedup.

version time
current master (b68ab603) 5.987 s ± 0.112 s
PR keeping condition (d6f5b773) 5.534 s ± 0.034 s
PR removing condition (dd13176) 5.384 s ± 0.023 s