Created
May 17, 2022 10:25
-
-
Save TobiX/d152d818ab14713e181f1fcfc39bf653 to your computer and use it in GitHub Desktop.
Quick & dirty bcrypt benchmark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use 5.12.0; | |
use strict; | |
use warnings; | |
use Benchmark ':hireswallclock'; | |
my $time; | |
my $rounds = 0; | |
do { | |
$rounds++; | |
$time = Benchmark::timeit(1, sub { | |
crypt('foobar', "\$2b\$$rounds\$01234567890123456789012") | |
}); | |
say "For $rounds it took ".timestr($time); | |
} while ($time->real < 30); |
On an old X230 (Core i5-3320M from 2012):
$ curl -Lfs https://gist.github.com/TobiX/d152d818ab14713e181f1fcfc39bf653/raw/b26396d865b42ae9b478c18703e8a96079dd78b9/bcryptbench.pl | perl
For 1 it took 4.29153e-05 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 2 it took 2.31266e-05 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 3 it took 5.00679e-06 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 4 it took 2.02656e-05 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 5 it took 1.81198e-05 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 6 it took 7.86781e-06 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 7 it took 1.71661e-05 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 8 it took 2.81334e-05 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 9 it took 1.71661e-05 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 10 it took 0.0676622 wallclock secs ( 0.06 usr + 0.00 sys = 0.06 CPU) @ 16.67/s (n=1)
For 11 it took 0.132322 wallclock secs ( 0.13 usr + 0.00 sys = 0.13 CPU) @ 7.69/s (n=1)
For 12 it took 0.263124 wallclock secs ( 0.26 usr + 0.00 sys = 0.26 CPU) @ 3.85/s (n=1)
For 13 it took 0.537851 wallclock secs ( 0.53 usr + 0.00 sys = 0.53 CPU) @ 1.89/s (n=1)
For 14 it took 1.0945 wallclock secs ( 1.09 usr + 0.00 sys = 1.09 CPU) @ 0.92/s (n=1)
For 15 it took 2.16098 wallclock secs ( 2.15 usr + 0.00 sys = 2.15 CPU) @ 0.47/s (n=1)
For 16 it took 4.27836 wallclock secs ( 4.27 usr + 0.00 sys = 4.27 CPU) @ 0.23/s (n=1)
For 17 it took 8.74663 wallclock secs ( 8.72 usr + 0.01 sys = 8.73 CPU) @ 0.11/s (n=1)
For 18 it took 17.4105 wallclock secs (17.38 usr + 0.01 sys = 17.39 CPU) @ 0.06/s (n=1)
For 19 it took 35.8238 wallclock secs (35.59 usr + 0.02 sys = 35.61 CPU) @ 0.03/s (n=1)
Another datapoint, Ryzen 7 3700X (2019):
For 1 it took 2.90871e-05 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 2 it took 4.76837e-06 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 3 it took 5.24521e-06 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 4 it took 1.19209e-06 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 5 it took 5.24521e-06 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 6 it took 8.10623e-06 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 7 it took 3.09944e-06 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 8 it took 4.29153e-06 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 9 it took 3.8147e-06 wallclock secs ( 0.00 usr + 0.00 sys = 0.00 CPU)
For 10 it took 0.044385 wallclock secs ( 0.04 usr + 0.00 sys = 0.04 CPU) @ 25.00/s (n=1)
For 11 it took 0.088104 wallclock secs ( 0.08 usr + 0.00 sys = 0.08 CPU) @ 12.50/s (n=1)
For 12 it took 0.175497 wallclock secs ( 0.17 usr + 0.00 sys = 0.17 CPU) @ 5.88/s (n=1)
For 13 it took 0.352071 wallclock secs ( 0.35 usr + 0.00 sys = 0.35 CPU) @ 2.86/s (n=1)
For 14 it took 0.704556 wallclock secs ( 0.70 usr + 0.00 sys = 0.70 CPU) @ 1.43/s (n=1)
For 15 it took 1.40713 wallclock secs ( 1.40 usr + 0.00 sys = 1.40 CPU) @ 0.71/s (n=1)
For 16 it took 2.8093 wallclock secs ( 2.80 usr + 0.00 sys = 2.80 CPU) @ 0.36/s (n=1)
For 17 it took 5.60176 wallclock secs ( 5.60 usr + 0.00 sys = 5.60 CPU) @ 0.18/s (n=1)
For 18 it took 11.1452 wallclock secs (11.14 usr + 0.00 sys = 11.14 CPU) @ 0.09/s (n=1)
For 19 it took 22.4514 wallclock secs (22.44 usr + 0.00 sys = 22.44 CPU) @ 0.04/s (n=1)
For 20 it took 45.6537 wallclock secs (45.64 usr + 0.00 sys = 45.64 CPU) @ 0.02/s (n=1)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As an example, here is the result for a i7-7820HQ (a CPU from 2017):