initial commit
[urisagit/Sort-Maker.git] / paper / bench_loops.pl
CommitLineData
7468c584 1#!/usr/local/bin/perl
2
3use Benchmark;
4
5use integer ;
6
7@list_100 = ( 1 .. 100 ) ;
8
9@list_10k = ( 1 .. 10_000 ) ;
10
11#@list_1m = ( 1 .. 1_000_000 ) ;
12
13timethese( 1 << 4, {
14
15# for_100 => sub { my @out; push( @out, $_ + 1 ) foreach @list_100 },
16
17# map_100 => sub { my @out; @out = map $_ + 1, @list_100 },
18
19 for_10k => sub { my @out; push( @out, $_ + 1 ) foreach @list_10k },
20
21 map_10k => sub { my @out; @out = map $_ + 1, @list_10k },
22
23 for_10k_null => sub { my @out; push( @out, $_ ) foreach @list_10k },
24
25 map_10k_null => sub { my @out; @out = map $_, @list_10k },
26
27 }
28) ;