CPU Speed Benchmark, BogusMips in Perl

By Xah Lee. Date: . Last updated: .

This is a silly test to see how fast is your computer in comparison to others.

Copy the code below, save it as bench2004.pl . To run it, type perl bench2004.pl in terminal.

# This is a lousy speed-testing perl script.
# It prints the time it take to run the script, in seconds.
# this file's name is bench2004.pl

# 2004, 2020-05-11
# Xah Lee
# CPU Speed Benchmark: BogusMips in Perl
# http://xahlee.info/UnixResource_dir/sultra_skami.html

use strict;
# convert to/from binary
sub dec2bin {
my $str = unpack ("B32", pack("N", shift ));
$str =~ s@^0+(?=\d)@@; # otherwise you'll get leading zeros
return $str;
my $start = time();
for (my $i=0; $i < 4469134; $i++) {dec2bin(3);}
my $end = time();
my $diff = $end - $start;
print "$diff\n";

For best results, do a reboot before test and stop all other programs or applications: cpu gauge, chat programs, browsers etc.


The following results, many using amazon cloud, is from Scott Preston, 2021-09-11.

Opti 90204i7-4790
AWS t2.nano ()4 Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz
AWS t3.nano (2 vCPU)6Intel(R) Xeon(R) Platinum 8175M CPU @ 2.50GHz
AWS t3.nano (2 vCPU) 20213Xeon 8259CL 2.5GHz
AWS t3a.nano (2 vCPU)6AMD EPYC 7000 series, 7571
AWS t4g.nano (2 vCPU)6AWS Gravitron 2 ARM processor
Google F1-micro (0.2 Vcpu)4Intel(R) Xeon(R) CPU @ 2.30GHz
Samsung S21+ Qualcomm 88810Qualcomm 888 ARM Cortex X1
Pi 3 B42BCM2709 ARMv7 Processor rev 4 (v7l)
Pi 3 B+36BCM2835 ARMv7 Processor rev 4 (v7l)
Pi Zero W214ARMv6-compatible processor rev 7 (v6l)
4600H4Ryzen 5 4600H
UltraSPARC-IIIi 1.28GHz25V250
Ultra SparcIIi 400Mhz104Ultra 5

other results:


rough conclusion.

Other speed tests ballpark figure sites

BogoMips is a rough estimate of your CPU speed. On linux, you can see its value by cat /proc/cpuinfo

There are also several cpu load testing programs. Do a apt-cache search stress.

See also: Why I'm Switching from Mac to Windows