unl0kr: optimize the main loop
Testing on Librem 5 (aarch64, unl0kr is compiled with -Dbuildtype=release
and used with default configuration and a physical keyboard):
Experiment | unl0kr, master branch | unl0kr, main_loop branch |
---|---|---|
Start unl0kr, wait for 1 min, press Enter | real 1m0,030s user 0m0,442s sys 0m0,336s |
real 1m0,074s user 0m0,331s sys 0m0,170s |
Start unl0kr, continuously press "1" on the keyboard for 1 min, press Enter | real 1m0,079s user 0m1,902s sys 0m0,323s |
real 1m0,547s user 0m1,830s sys 0m0,168s |
Merge request reports
Activity
@cherrypicker Did you make some measurements with it? It would be nice to test on different phones.
Thanks for contributing this and interesting find! The main loop has gone through a few very different implementations over time but I have never actually timed it as it didn't seem critical. I'm happy to land this though given that the new code isn't much more complicated than the old and shaves off some processing time.
We can test it on a few more devices as part of the pmaports MR once we make another release.
Could you add a changelog entry, ideally thanking yourself for the contribution?
added 3 commits
-
e4e3d37e...3196e47d - 2 commits from branch
postmarketOS:master
- 558e9465 - unl0kr: optimize the main loop
-
e4e3d37e...3196e47d - 2 commits from branch
We can also optimize
lv_delay_ms()
. The generic version just do useless work in a cycle until the time reached. But seems this function is not used often. What do you think?$ grep -rF 'lv_delay_ms' drivers/display/lcd/lv_lcd_generic_mipi.c: lv_delay_ms((uint32_t)(num) * 10); drivers/display/lcd/lv_lcd_generic_mipi.c: lv_delay_ms(10); drivers/display/lcd/lv_lcd_generic_mipi.c: lv_delay_ms(200); drivers/display/lcd/lv_lcd_generic_mipi.c: lv_delay_ms(300); tick/lv_tick.h:void lv_delay_ms(uint32_t ms); tick/lv_tick.c:void lv_delay_ms(uint32_t ms)
added 16 commits
-
a89df3a0...d5838377 - 15 commits from branch
postmarketOS:master
- 3613ba4e - Merge branch 'master' into 'main_loop'
-
a89df3a0...d5838377 - 15 commits from branch
mentioned in commit 18b576f2