chaotic-aur / toolbox

Unified kit with all the scripts required for maintaining the repository 🧰
https://aur.chaotic.cx
GNU Affero General Public License v3.0
81 stars 11 forks source link

Improve performance of interference-bump #96

Closed xiota closed 7 months ago

xiota commented 9 months ago

More verbose, but 21-25x speed-up.

Test scripts: bump_old.sh, bump_new.sh

$ time ./bump_old.sh acidrip zrythm zulucrypt

cmd: ./bump_old.sh acidrip zrythm zulucrypt
cpu: 100%
mem: 57
usr: 18.319
sys: 6.261
tot: 24.382

$ time ./bump_new.sh acidrip zrythm zulucrypt

cmd: ./bump_new.sh acidrip zrythm zulucrypt
cpu: 104%
mem: 56
usr: 0.851
sys: 0.178
tot: 0.983

Performance note: Original function was O(n^2) because it has nested n-loops. Revised function is O(n log n) because of use of sort. If not for sort, it would be O(n) because the outer loops are over small lists, O(1). Expected performance should be close to O(n) because package lists should be already sorted. It looks more inefficient because of repeated O(1) and O(n) blocks. But they combine to O(n).

Behavior change. Instead of printing entire PKGREL_BUMPS file, prints only bumped packages that haven't been rebuilt yet (without version info) because they are probably broken. Current output:

mate-panel-genmon-git
meshlab
meshlab-git
multimc5
mutter-performance
obs-streamfx
pixelorama-git
python-pympv
qucs
servo-git
vim-coc-sh-git
vscodium-electron
dr460nf1r3 commented 9 months ago

A major improvement πŸš€

xiota commented 9 months ago

CI is failing because of shellcheck, but when I run it locally, it doesn't complain about anything.

dr460nf1r3 commented 9 months ago

The logs state that prettier isn't happy πŸ€“

xiota commented 9 months ago

Prettier is not happy because it doesn't have files to process?

$ prettier . && shellcheck *
[error] No supported files were found in the directory: ".".

$ if prettier . ; then echo true ; else echo false ; fi
[error] No supported files were found in the directory: ".".
false

$ if shellcheck * ; then echo true ; else echo false ; fi
true
dr460nf1r3 commented 9 months ago

I think you might be missing the shell plugin, iirc Arch had several packages for this purpose.

https://www.npmjs.com/package/prettier-plugin-sh

https://github.com/chaotic-aur/toolbox/blob/main/package.json#L5

For reference see the #lint section of the toolboxes' README 😁

xiota commented 9 months ago

Still can't find what's wrong.

$ yarn run lint
yarn run v1.22.19
$ prettier --check . && shellcheck src/*.sh src/lib/*.sh guest/bin/* slurm-jobs/*/*.sh
Checking formatting...
All matched files use Prettier code style!
Done in 3.28s.
dr460nf1r3 commented 9 months ago

I will be taking a look as soon as possible.

xiota commented 9 months ago

Got it... yarn prettify took care of it.

xiota commented 9 months ago

This doesn't work with split packages. Did the original?

dr460nf1r3 commented 9 months ago

This doesn't work with split packages. Did the original?

Afaik it did not, and pkgbase also did not :eyes:

xiota commented 9 months ago

This doesn't work with split packages. Did the original?

Afaik it did not, and pkgbase also did not πŸ‘€

Will think about how/if-possible to add it. Would be easier if some way to track them.