performance measurements

Each table row shows performance measurements for this Perl program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
2,000Bad Output  301   

Read the ↓ make, command line, and program output logs to see how this program was run.

Read pidigits benchmark to see what this program should do.

 notes

This is perl 5, version 18, subversion 0 (v5.18.0) built for i686-linux

Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
                        PERL_PRESERVE_IVUV PERL_SAWAMPERSAND USE_LARGE_FILES
                        USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF

 pidigits Perl #3 program source code

# The Computer Language Benchmarks Game
# http://benchmarksgame.alioth.debian.org/
#
# transliterated from Mario Pernici's Python 3 program
# contributed by Jesse Luehrs

use strict;
use Math::GMP;

my $N = $ARGV[0];

my ($i, $k, $ns) = (0, 0, 0);
my $k1 = 1;
my ($n, $a, $d, $t, $u) = map Math::GMP->new($_), (1, 0, 1, 0, 0);

while (1) {
    $k++;
    $t = $n * 2;
    $n *= $k;
    $a += $t;
    $k1 += 2;
    $a *= $k1;
    $d *= $k1;
    if ($a >= $n) {
        $u = $n * 3 + $a;
        $t = $u / $d;
        $u -= $t * $d;
        $u += $n;
        if ($d > $u) {
            $ns = $ns * 10 + $t;
            $i++;
            if ($i % 10 == 0) {
                printf "%010d\t:%d\n", $ns, $i;
                $ns = 0;
            }
            last if $i >= $N;
            $a -= $d * $t;
            $a *= 10;
            $n *= 10;
        }
    }
}

 make, command-line, and program output logs

Tue, 21 May 2013 20:33:32 GMT

COMMAND LINE:
/usr/local/src/perl-5.18.0_no_ithreads_no_multi/bin/perl pidigits.perl-3.perl 2000

UNEXPECTED OUTPUT 

1,4c1,4
< 0994109005	:10
< 1602965088	:20
< 1969371031	:30
< 0912949605	:40
---
> 3141592653	:10
> 5897932384	:20
> 6264338327	:30
> 9502884197	:40
7,11c7,11
< 0297340520	:70
< 1915378441	:80
< 1272868890	:90
< 1047149771	:100
< 1231546273	:110
---
> 4592307816	:70
> 4062862089	:80
> 9862803482	:90
> 5342117067	:100
> 9821480865	:110
13,22c13,22
< 0651393665	:130
< 1210855021	:140
< 0388457164	:150
< 2038666506	:160
< 0693543371	:170
< 1704626907	:180
< 1054688356	:190
< 0959369227	:200
< 0000430153	:210
< 1370966150	:220
---
> 7093844609	:130
> 5505822317	:140
> 2535940812	:150
> 8481117450	:160
> 2841027019	:170
> 3852110555	:180
> 9644622948	:190
> 9549303819	:200
> 6442881097	:210
> 5665933446	:220
24,25c24,25
< 1231194668	:240
< 0976234613	:250
---
> 3378678316	:240
> 5271201909	:250
27c27
< 0198551213	:270
---
> 2346034861	:270
30,33c30,33
< 1729946831	:300
< 1577103358	:310
< 1768188585	:320
< 1045701148	:330
---
> 6024914127	:300
> 3724587006	:310
> 6063155881	:320
> 7488152092	:330
36c36
< 0346808092	:360
---
> 6789259036	:360
38c38
< 1193237369	:380
---
> 5488204665	:380
41,49c41,49
< 0035605407	:410
< 0133508251	:420
< 0944702469	:430
< 1671842469	:440
< 0720577262	:450
< 1632011435	:460
< 1037561081	:470
< 0893607976	:480
< 0596260642	:490
---
> 4330572703	:410
> 6575959195	:420
> 3092186117	:430
> 3819326117	:440
> 9310511854	:450
> 8074462379	:460
> 9627495673	:470
> 5188575272	:480
> 4891227938	:490
51,52c51,52
< 0835883688	:510
< 0293172995	:520
---
> 2983367336	:510
> 2440656643	:520
54,60c54,60
< 0344555177	:540
< 0748251235	:550
< 0019502435	:560
< 0611470773	:570
< 1998209456	:580
< 1699264536	:590
< 0324489569	:600
---
> 4639522473	:540
> 7190702179	:550
> 8609437027	:560
> 7053921717	:570
> 6293176752	:580
> 3846748184	:590
> 6766940513	:600
63,64c63,64
< 0631093486	:630
< 0610305961	:640
---
> 2778577134	:630
> 2757789609	:640
69,71c69,71
< 0662628283	:690
< 1099324331	:700
< 1125232265	:710
---
> 7105079227	:690
> 9689258923	:700
> 5420199561	:710
75c75
< 1034680052	:750
---
> 7477130996	:750
77,78c77,78
< 1352516335	:770
< 0855354051	:780
---
> 3499999983	:770
> 7297804995	:780
80,85c80,85
< 1718512241	:800
< 0912511353	:810
< 1051941006	:820
< 2130255786	:830
< 1039501207	:840
< 0966963892	:850
---
> 8160963185	:800
> 9502445945	:810
> 5346908302	:820
> 6425223082	:830
> 5334468503	:840
> 5261931188	:850
87,101c87,101
< 1636391640	:870
< 0145082264	:880
< 1666722523	:890
< 1324463786	:900
< 1450769842	:910
< 2140071039	:920
< 0968472638	:930
< 1734870139	:940
< 1642552281	:950
< 1743327109	:960
< 0023743158	:970
< 1835051982	:980
< 1218668646	:990
< 0626485606	:1000
< 0791017980	:1010
---
> 3783875288	:870
> 6587533208	:880
> 3814206171	:890
> 7766914730	:900
> 3598253490	:910
> 4287554687	:920
> 3115956286	:930
> 3882353787	:940
> 5937519577	:950
> 8185778053	:960
> 2171226806	:970
> 6130019278	:980
> 7661119590	:990
> 9216420198	:1000
> 9380952572	:1010
103c103
< 1131382288	:1030
---
> 3278865936	:1030
105c105
< 0380579251	:1050
---
> 6823030195	:1050
107,108c107,108
< 1100023144	:1070
< 0112457741	:1080
---
> 9689957736	:1070
> 2259941389	:1080
110c110
< 0687307667	:1100
---
> 2834791315	:1100
112,113c112,113
< 0306667047	:1120
< 0918360739	:1130
---
> 2454150695	:1120
> 9508295331	:1130
115,119c115,119
< 1594107802	:1150
< 1670062726	:1160
< 0051480981	:1170
< 0765433631	:1180
< 0574260446	:1190
---
> 5889075098	:1150
> 3817546374	:1160
> 6493931925	:1170
> 5060400927	:1180
> 7016711390	:1190
121,122c121,122
< 0710877955	:1210
< 1342109305	:1220
---
> 2858361603	:1210
> 5637076601	:1220
124,127c124,127
< 0808112550	:1240
< 0877743782	:1250
< 0649858241	:1260
< 1184792255	:1270
---
> 2955596198	:1240
> 9467678374	:1250
> 4944825537	:1260
> 9774726847	:1270
129,135c129,135
< 0325837372	:1290
< 2111585843	:1300
< 0785653122	:1310
< 0751431562	:1320
< 0457194760	:1330
< 1070305988	:1340
< 1667535703	:1350
---
> 4620804668	:1290
> 4259069491	:1300
> 2933136770	:1310
> 2898915210	:1320
> 4752162056	:1330
> 9660240580	:1340
> 3815019351	:1350
138,141c138,141
< 0454680030	:1380
< 1766715624	:1390
< 1747731931	:1400
< 1088300886	:1410
---
> 4749647326	:1380
> 3914199272	:1390
> 6042699227	:1400
> 9678235478	:1410
143,144c143,144
< 0773961255	:1430
< 0311147855	:1440
---
> 7216412199	:1430
> 2458631503	:1440
146,160c146,160
< 1262100202	:1460
< 1703065810	:1470
< 2144476051	:1480
< 0466821163	:1490
< 1160995703	:1500
< 1026198048	:1510
< 1282092967	:1520
< 1728680770	:1530
< 1204152585	:1540
< 1905526591	:1550
< 0194529798	:1560
< 0100076918	:1570
< 1223216879	:1580
< 1024838153	:1590
< 1330342856	:1600
---
> 5557067498	:1460
> 3850549458	:1470
> 8586926995	:1480
> 6909272107	:1490
> 9750930295	:1500
> 5321165344	:1510
> 9872027559	:1520
> 6023648066	:1530
> 5499119881	:1540
> 8347977535	:1550
> 6636980742	:1560
> 6542527862	:1570
> 5518184175	:1580
> 7467289097	:1590
> 7772793800	:1600
163,183c163,183
< 0025733566	:1630
< 1281050470	:1640
< 2049873206	:1650
< 1718910213	:1660
< 1378037686	:1670
< 1131734002	:1680
< 1996072379	:1690
< 0484006841	:1700
< 1307292593	:1710
< 0420068039	:1720
< 1399888324	:1730
< 1331987626	:1740
< 2125066606	:1750
< 0421393069	:1760
< 0459525573	:1770
< 1319321340	:1780
< 1977360621	:1790
< 0018643846	:1800
< 1680484328	:1810
< 0372090065	:1820
< 1093411340	:1830
---
> 2173217214	:1630
> 7723501414	:1640
> 4197356854	:1650
> 8161361157	:1660
> 3525521334	:1670
> 7574184946	:1680
> 8438523323	:1690
> 9073941433	:1700
> 3454776241	:1710
> 6862518983	:1720
> 5694855620	:1730
> 9921922218	:1740
> 4272550254	:1750
> 2568876717	:1760
> 9049460165	:1770
> 3466804988	:1780
> 6272327917	:1790
> 8608578438	:1800
> 3827967976	:1810
> 6814541009	:1820
> 5388378636	:1830
185c185
< 0103768403	:1850
---
> 2251252051	:1850
187,200c187,200
< 1789161192	:1870
< 1974488746	:1880
< 2049044854	:1890
< 0063177538	:1900
< 0919959138	:1910
< 0056435846	:1920
< 0752156417	:1930
< 1427158619	:1940
< 2142224432	:1950
< 1025313713	:1960
< 1444656842	:1970
< 0496648672	:1980
< 1700846094	:1990
< 0485308604	:2000
---
> 6084128488	:1870
> 6269456042	:1880
> 4196528502	:1890
> 2210661186	:1900
> 3067442786	:1910
> 2203919494	:1920
> 5047123713	:1930
> 7869609563	:1940
> 6437191728	:1950
> 7467764657	:1960
> 5739624138	:1970
> 9086583264	:1980
> 5995813390	:1990
> 4780275900	:2000

PROGRAM OUTPUT:
0994109005	:10
1602965088	:20
1969371031	:30
0912949605	:40
1693993751	:50
0582097494	:60
0297340520	:70
1915378441	:80
1272868890	:90
1047149771	:100
1231546273	:110
1328230664	:120
0651393665	:130
1210855021	:140
0388457164	:150
2038666506	:160
0693543371	:170
1704626907	:180
1054688356	:190
0959369227	:200
0000430153	:210
1370966150	:220
1284756482	:230
1231194668	:240
0976234613	:250
1456485669	:260
0198551213	:270
0454326648	:280
2133936072	:290
1729946831	:300
1577103358	:310
1768188585	:320
1045701148	:330
0962829254	:340
0917153643	:350
0346808092	:360
0011330530	:370
1193237369	:380
2138414695	:390
1941511609	:400
0035605407	:410
0133508251	:420
0944702469	:430
1671842469	:440
0720577262	:450
1632011435	:460
1037561081	:470
0893607976	:480
0596260642	:490
1830119491	:500
0835883688	:510
0293172995	:520
0860213949	:530
0344555177	:540
0748251235	:550
0019502435	:560
0611470773	:570
1998209456	:580
1699264536	:590
0324489569	:600
2000568127	:610
1452635608	:620
0631093486	:630
0610305961	:640
1736371787	:650
2146844090	:660
1224953430	:670
1465495853	:680
0662628283	:690
1099324331	:700
1125232265	:710
1212902196	:720
0864034418	:730
1598136297	:740
1034680052	:750
0518707211	:760
1352516335	:770
0855354051	:780
1059731732	:790
1718512241	:800
0912511353	:810
1051941006	:820
2130255786	:830
1039501207	:840
0966963892	:850
1710100031	:860
1636391640	:870
0145082264	:880
1666722523	:890
1324463786	:900
1450769842	:910
2140071039	:920
0968472638	:930
1734870139	:940
1642552281	:950
1743327109	:960
0023743158	:970
1835051982	:980
1218668646	:990
0626485606	:1000
0791017980	:1010
0106548586	:1020
1131382288	:1030
1533818279	:1040
0380579251	:1050
2035301852	:1060
1100023144	:1070
0112457741	:1080
1249721775	:1090
0687307667	:1100
1557485724	:1110
0306667047	:1120
0918360739	:1130
1686172785	:1140
1594107802	:1150
1670062726	:1160
0051480981	:1170
0765433631	:1180
0574260446	:1190
0984882401	:1200
0710877955	:1210
1342109305	:1220
0471018194	:1230
0808112550	:1240
0877743782	:1250
0649858241	:1260
1184792255	:1270
1040475346	:1280
0325837372	:1290
2111585843	:1300
0785653122	:1310
0751431562	:1320
0457194760	:1330
1070305988	:1340
1667535703	:1350
1253382430	:1360
0355876402	:1370
0454680030	:1380
1766715624	:1390
1747731931	:1400
1088300886	:1410
1636009341	:1420
0773961255	:1430
0311147855	:1440
0286182974	:1450
1262100202	:1460
1703065810	:1470
2144476051	:1480
0466821163	:1490
1160995703	:1500
1026198048	:1510
1282092967	:1520
1728680770	:1530
1204152585	:1540
1905526591	:1550
0194529798	:1560
0100076918	:1570
1223216879	:1580
1024838153	:1590
1330342856	:1600
0816470600	:1610
1614524919	:1620
0025733566	:1630
1281050470	:1640
2049873206	:1650
1718910213	:1660
1378037686	:1670
1131734002	:1680
1996072379	:1690
0484006841	:1700
1307292593	:1710
0420068039	:1720
1399888324	:1730
1331987626	:1740
2125066606	:1750
0421393069	:1760
0459525573	:1770
1319321340	:1780
1977360621	:1790
0018643846	:1800
1680484328	:1810
0372090065	:1820
1093411340	:1830
0950680064	:1840
0103768403	:1850
1739298489	:1860
1789161192	:1870
1974488746	:1880
2049044854	:1890
0063177538	:1900
0919959138	:1910
0056435846	:1920
0752156417	:1930
1427158619	:1940
2142224432	:1950
1025313713	:1960
1444656842	:1970
0496648672	:1980
1700846094	:1990
0485308604	:2000

Revised BSD license

  Home   Conclusions   License   Play