💾 Archived View for thrig.me › blog › 2023 › 10 › 30 › bench.pl captured on 2023-11-04 at 12:27:24.
-=-=-=-=-=-=-
#!/usr/bin/perl # bench.pl - benchmark "random line from a file" implementations use 5.36.0; use Benchmark 'cmpthese'; use Capture::Tiny 'capture'; my $file = shift // die "Usage: bench.pl filename"; # randline.c is somewhere in https://thrig.me/src/scripts.git cmpthese -5, { C => sub { capture { system "randline", $file } }, pl => sub { capture { system "./randline.pl", $file } }, sh => sub { capture { system "./randline.sh", $file } }, }