Skip to content
/ crap Public
forked from andrewrk/poop

Counter Reading Acquisition Platform - A fork of POOP with macOS support.

License

Notifications You must be signed in to change notification settings

D-Berg/crap

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

105 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crap - A fork of poop

Stop flushing your performance down the drain.

Overview

This command line tool uses Linux's perf_event_open and macOS kperf functionality to compare the performance of multiple commands with a colorful terminal user interface.

Screenshot 2025-12-06 at 11 29 16

Usage

Usage: crap [options] <command1> ... <commandN>

Compares the performance of the provided commands.

Options:
 -d, --duration <ms>    (default: 5000) how long to repeatedly sample each command
 --color <when>         (default: auto) color output mode
                            available options: 'auto', 'never', 'ansi'
 -s, --shell <shell>    (default: none) specify which shell to run commands in
 -w, --warmup <count>   (default: 0) specify number of warmups before running each command
 -f, --allow-failures   (default: false) compare performance if a non-zero exit code is returned

Supported Platforms and counters

Counters Linux macOS Windows
wall_time yes yes yes
peak_rss yes yes yes
cpu_cycles yes sudo no
instructions yes sudo no
cache_references yes no no
cache_misses yes sudo no
branch_misses yes sudo no

Building from source and installation

Tested with Zig 0.15.2.

# set install path to ~/.local to install in ~/.local/bin
zig build -Doptimize=ReleaseSafe -p <install_path>

Comparison with Hyperfine

Crap (so far) is brand new, whereas Hyperfine is a mature project with more configuration options and generally more polish.

However, crap does report peak memory usage as well as 5 other hardware counters, which I personally find useful when doing performance testing. Hey, maybe it will inspire the Hyperfine maintainers to add the extra data points!

By default crap does not run the commands in a shell, use -s/--shell zsh to run the command in a shell. This has the upside of not including shell spawning noise in the data points collected, and the downside of not supporting strings inside the commands. Hyperfine by default runs the commands in a shell, with command line options to disable this.

Crap treats the first command as a reference and the subsequent ones relative to it, giving the user the choice of the meaning of the coloring of the deltas. Hyperfine by default prints the wall-clock-fastest command first, with a command line option to select a different reference command explicitly.

Note: on macos to get some of the extra performance counters, sudo privelage is needed.

Credits

About

Counter Reading Acquisition Platform - A fork of POOP with macOS support.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Zig 99.9%
  • C 0.1%