How-Tos

How-To: Time Your Omarchy Scripts With hyperfine

Leave a comment

Omarchy 4.5’s menu speedup came from measuring each check and replacing slow tool calls with sysfs reads. You can do the same with your own scripts and keybinds using hyperfine.

1. Install it

sudo pacman -S hyperfine

2. Time a command

hyperfine --warmup 3 -N 'lspci'

-N skips the shell wrapper so you measure the command itself. Warmup runs keep cold caches from skewing results.

3. Compare two ways of doing the same thing

hyperfine --warmup 3 \
  'lspci | grep -c VGA' \
  'grep -l ^0x03 /sys/bus/pci/devices/*/class | wc -l'

hyperfine prints the mean, the spread, and how many times faster the winner is. The sysfs read skips forking lspci, and per the Omarchy PR, it also avoids waking a sleeping dGPU.

4. Time your own scripts

hyperfine --warmup 2 --runs 20 '~/.local/bin/my-status-script'

Add --export-markdown times.md to keep a before/after record.

Tips

  • Run on AC power with nothing heavy in the background.
  • Fewer forks usually wins: one awk beats grep | cut | sed.
  • Check that the output didn’t change. Faster and wrong isn’t a win.

God Bless, and Happy hacking!

References & Further Reading

Subscribe (RSS) Follow How-Tos via RSS

Leave a note

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.