Skip to content

perf: speed up (>3x) get_uris, display_downloadfile with bash builtin#239

Merged
Lasall merged 1 commit intoilikenwf:masterfrom
Rongronggg9:perf/builtin
May 1, 2024
Merged

perf: speed up (>3x) get_uris, display_downloadfile with bash builtin#239
Lasall merged 1 commit intoilikenwf:masterfrom
Rongronggg9:perf/builtin

Conversation

@Rongronggg9
Copy link
Contributor

While downloading is relatively faster than the vanilla APT, the overhead of parsing notably slows apt-fast down before it can start downloading. This is because the massive usage of utilities causes bash to spawn processes frequently, which is very expensive.

The performance hot spots of apt-fast are get_uris() and display_downloadfile(). The patch replaces some utilities' usage in these functions with bash builtins to eliminate the extra overhead. My brief test (with default /etc/apt-fast.conf) shows the overall parsing performance is >3x faster than before.

master:

$ time (echo 'n' | sudo apt-fast dist-upgrade | wc -l)
417

real    0m7.785s
user    0m0.007s
sys     0m0.023s

patch applied:

$ time (echo 'n' | sudo apt-fast dist-upgrade | wc -l)
417

real    0m2.002s
user    0m0.014s
sys     0m0.015s

While downloading is relatively faster than the vanilla APT, the
overhead of parsing notably slows apt-fast down before it can start
downloading. This is because the massive usage of utilities causes bash
to spawn processes frequently, which is very expensive.

The performance hot spots of apt-fast are get_uris() and
display_downloadfile(). The patch replaces some utilities' usage in
these functions with bash builtins to eliminate the extra overhead. My
brief test (with default /etc/apt-fast.conf) shows the overall parsing
performance is >3x faster than before.

master:
	$ time (echo 'n' | sudo apt-fast dist-upgrade | wc -l)
	417

	real    0m7.785s
	user    0m0.007s
	sys     0m0.023s

patch applied:
	$ time (echo 'n' | sudo apt-fast dist-upgrade | wc -l)
	417

	real    0m2.002s
	user    0m0.014s
	sys     0m0.015s

Signed-off-by: Rongrong <[email protected]>
@Lasall
Copy link
Collaborator

Lasall commented Apr 29, 2024

Very cool, thank you for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants