NAME
Bencher::Scenario::CBlocks::Numeric - Benchmark numeric performance of C::Blocks
VERSION
This document describes version 0.001 of Bencher::Scenario::CBlocks::Numeric (from Perl distribution Bencher-Scenarios-CBlocks), released on 2016-12-10.
SYNOPSIS
To run benchmark with default option:
% bencher -m CBlocks::Numeric
For more options (dump scenario, list/include/exclude/add participants, list/include/exclude/add datasets, etc), see bencher or run bencher --help
.
DESCRIPTION
Each code generates random number (the perl
participant using pure-perl code.
Packaging a benchmark script as a Bencher scenario makes it convenient to include/exclude/add participants/datasets (either via CLI or Perl code), send the result to a central repository, among others . See Bencher and bencher (CLI) for more details.
BENCHMARK PARTICIPANTS
perl (perl_code)
Code template:
my $a = 698769069; my ($x, $y, $z, $c) = (123456789, 362436000, 521288629, 7654321); my $rand; for (1 .. <N>) { my $t; $x = 69069*$x+12345; $y ^= ($y<<13); $y ^= ($y>>17); $y ^= ($y<<5); $t = $a*$z+$c; $c = ($t>>32); $z = $t; $rand = $x+$y+$z; } return $rand;
C::Blocks (perl_code)
Code template:
use C::Blocks; use C::Blocks::Types qw(uint); clex { /* Note: y must never be set to zero; * z and c must not be simultaneously zero */ unsigned int x = 123456789,y = 362436000, z = 521288629,c = 7654321; /* State variables */ unsigned int KISS() { unsigned long long t, a = 698769069ULL; x = 69069*x+12345; y ^= (y<<13); y ^= (y>>17); y ^= (y<<5); t = a*z+c; c = (t>>32); return x+y+(z=t); } } my uint $to_return = 0; cblock { for (int i = 0; i < <N>; i++) $to_return = KISS(); } return $to_return;
BENCHMARK DATASETS
10
31
100
316
1000
3235
10000
31622
100000
316227
SAMPLE BENCHMARK RESULTS
Run on: perl: v5.24.0, CPU: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz (4 cores), OS: GNU/Linux Debian version 8.5, OS kernel: Linux version 3.16.0-4-amd64.
Benchmark with default options (bencher -m CBlocks::Numeric
):
#table1#
+-------------+---------+------------+---------------+------------+-----------+---------+
| participant | dataset | rate (/s) | time (ms) | vs_slowest | errors | samples |
+-------------+---------+------------+---------------+------------+-----------+---------+
| C::Blocks | 316227 | 8.6 | 120 | 1 | 0.00012 | 6 |
| perl | 316227 | 9.29 | 108 | 1.08 | 2.7e-05 | 6 |
| C::Blocks | 100000 | 27.3 | 36.6 | 3.17 | 1.3e-05 | 6 |
| perl | 100000 | 29 | 35 | 3.4 | 0.00016 | 6 |
| perl | 31622 | 91 | 11 | 11 | 8.6e-05 | 6 |
| C::Blocks | 10000 | 239.2 | 4.18 | 27.76 | 3.4e-07 | 8 |
| perl | 10000 | 297.4 | 3.362 | 34.51 | 2.9e-07 | 6 |
| C::Blocks | 3235 | 775 | 1.29 | 89.9 | 9e-07 | 10 |
| perl | 3235 | 921 | 1.09 | 107 | 3.9e-07 | 6 |
| C::Blocks | 1000 | 2786.35 | 0.358893 | 323.34 | 0 | 6 |
| perl | 1000 | 2994.21 | 0.333978 | 347.461 | 0 | 6 |
| C::Blocks | 31622 | 4370.72 | 0.228795 | 507.197 | 0 | 6 |
| C::Blocks | 316 | 8778.29 | 0.113917 | 1018.67 | 0 | 6 |
| perl | 316 | 9426.91 | 0.106079 | 1093.94 | 0 | 8 |
| C::Blocks | 100 | 26500 | 0.0378 | 3070 | 2.3e-08 | 7 |
| perl | 100 | 28619.5 | 0.0349412 | 3321.13 | 0 | 6 |
| perl | 31 | 94007 | 0.0106375 | 10909 | 0 | 6 |
| C::Blocks | 10 | 239790 | 0.00417031 | 27826.3 | 0 | 6 |
| perl | 10 | 284515 | 0.00351475 | 33016.3 | 0 | 6 |
| C::Blocks | 31 | 3552810 | 0.000281467 | 412283 | 0 | 7 |
+-------------+---------+------------+---------------+------------+-----------+---------+
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/Bencher-Scenarios-CBlocks.
SOURCE
Source repository is at https://github.com/perlancar/perl-Bencher-Scenarios-CBlocks.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Bencher-Scenarios-CBlocks
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
SEE ALSO
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.