dylanaraps / neofetch

🖼️ A command-line system information tool written in bash 3.2+
MIT License
22.14k stars 1.66k forks source link

Faster eopkg installed-count #669

Closed ikeydoherty closed 7 years ago

ikeydoherty commented 7 years ago

Running eopkg list-installed can take a bit of time as it has to load the XML descriptions to spit them back out. Here's a suggestion, if you're up for it :)

A faster method is:

ls /var/lib/eopkg/package -1 | wc -l

Each directory in that directory contains files.xml and metadata.xml, and constitute on-disk package DB entries.

New method

time ls /var/lib/eopkg/package -1 | wc -l
1821
ls --color=tty /var/lib/eopkg/package -1  0.00s user 0.00s system 95% cpu 0.003 total
wc -l  0.00s user 0.00s system 23% cpu 0.003 total

Old method

time eopkg list-installed | wc -l
1821
eopkg list-installed  3.20s user 0.06s system 100% cpu 3.260 total
wc -l  0.00s user 0.01s system 0% cpu 3.259 total
konimex commented 7 years ago

Applied to master in https://github.com/dylanaraps/neofetch/commit/0c038451000e42a93323268a8e233062cea4783c, thanks!

ikeydoherty commented 7 years ago

Cheers bud :D