chore: optimize termux_step_get_dependencies#24567
Conversation
45445be to
fd00a88
Compare
fd00a88 to
3f47560
Compare
robertkirkman
left a comment
There was a problem hiding this comment.
I tested it, I can confirm this is faster. I thought that termux_step_get_dependencies() was pretty fast already, but this change can add up to a significant benefit since it runs a lot.
|
This change makes it faster mostly for package rebuilding since I modified only this codepath. |
|
Well, seems like $ time for ((i=0; i<1000000; i++)); do :; done
real 0m1.017s
user 0m1.017s
sys 0m0.000s
$ time for ((i=0; i<1000000; i++)); do [ -f /dev/null ]; done
real 0m1.949s
user 0m1.629s
sys 0m0.319s
$ time for ((i=0; i<1000000; i++)); do [[ -f /dev/null ]]; done
real 0m1.389s
user 0m1.075s
sys 0m0.314s |
3f47560 to
f1d793a
Compare
|
Also I placed post-timestamp-creation sleep with check if it is needed or 1 second already passed. Should reduce building of each package by 1 second. I checked all packages overriding |
3032780 to
3b2e89a
Compare
|
I will merge this in 24 hours if nobody minds or after it gets 2+ more approves. |
78b1da8 to
6bb8318
Compare
6bb8318 to
acc1065
Compare
da397e2 to
c2c9a0d
Compare
c2c9a0d to
4067602
Compare
|
Ok, I'll merge it in 20 hours if nobody minds or after it gets 2+ more approves. |
TomJo2000
left a comment
There was a problem hiding this comment.
Forgot to approve this earlier.
Go ahead.
Wait, let me test how this all works with termux-pacman repos. |
…imestamp_file Removed external commands invocations where possible. United some conditions under single test invocation. Refactored termux_extract_dep_info to avoid re-sourcing build.sh. Modified package extraction sequence to avoid storage hit and avoid spawning two more commands for checking if in-tar files are prefixed with `./` or not. Modern `tar` compares timestamps with microsecond precision so we do not need to sleep for a whole second to create a correct timestamp, 100 ms should be enough
4067602 to
a5df859
Compare
Removed external commands invocations where possible.
United some conditions under single test invocation
Refactored termux_extract_dep_info to avoid re-sourcing build.sh.
Modified package extraction sequence to avoid storage hit and avoid spawning two more commands for checking if in-tar files are prefixed with
./or not.With these changes
termux_step_dependenciesexecution time drops from12sto7sduringkf6-breeze-iconsrebuilding.Also it reduces
~0.1s-~2.0sper package during archive extracting step (depends on package size), which is good for packages with lots of dependencies (likekf6-breeze-icons).