-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbenchmark.txt
More file actions
83 lines (68 loc) · 11.8 KB
/
benchmark.txt
File metadata and controls
83 lines (68 loc) · 11.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
###############################################
### ###
### /-----------------------------------\ ###
### | Not intended as a real benchmark! | ###
### \-----------------------------------/ ###
### ###
### (I just wanted a rough speesd ###
### comparison between Ruby and C) ###
### ###
###############################################
# <config>
declare -- SKIP=""
declare -- N="2000"
declare -- FACTORADIC="factoradic"
declare -- GCC="gcc"
declare -- CLANG="clang"
# <DATA>
declare -- DECVALUE="9876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210"
declare -- FACTVALUE="256,181,382,250,417,105,148,94,220,219,290,193,126,393,317,38,359,351,21,230,317,226,298,315,206,364,34,285,21,327,187,336,266,0,334,231,82,309,248,305,300,102,201,321,315,105,36,155,146,81,120,158,24,227,156,284,364,219,157,319,202,309,355,198,126,78,353,247,220,9,152,81,237,122,91,5,345,206,181,93,257,280,231,57,288,314,316,93,193,360,239,196,341,333,56,91,325,3,204,289,320,280,80,173,314,211,322,53,39,105,151,227,237,107,42,95,300,161,263,60,294,39,108,32,132,181,290,43,315,211,8,30,155,224,30,252,73,110,65,157,63,177,236,32,173,201,94,166,108,215,249,125,101,77,10,153,155,222,110,9,154,66,209,27,184,102,43,206,13,178,120,185,162,112,214,37,50,32,188,255,151,107,156,184,180,51,215,8,10,54,248,173,170,233,46,228,187,35,238,212,101,221,73,115,188,111,99,32,241,40,211,121,223,21,131,96,121,123,180,32,222,142,174,140,193,182,145,167,115,59,205,107,188,178,195,52,48,67,191,172,204,122,206,199,1,34,167,44,156,180,83,149,156,53,116,157,130,52,43,91,172,22,70,87,149,104,34,178,115,86,71,86,112,136,94,171,137,74,159,129,118,57,18,145,112,51,4,78,116,57,108,7,41,14,84,148,90,8,143,110,66,89,140,83,88,4,105,12,82,73,89,63,6,94,12,61,14,92,88,95,86,54,120,61,6,3,9,122,39,45,86,2,56,49,68,31,85,9,64,50,32,58,32,48,64,62,72,68,77,36,15,73,77,49,20,19,11,84,81,74,54,54,33,25,18,35,56,57,62,19,22,47,23,13,53,36,28,60,49,11,24,28,9,66,35,43,9,60,6,29,40,13,9,36,8,48,36,44,38,25,29,19,42,26,41,7,26,10,25,4,17,0,20,3,9,5,30,20,4,8,11,8,19,4,20,8,7,10,16,18,13,16,9,2,0,9,12,3,3,4,7,0,7,4,0,3,3,0,0,0"
length of DECVALUE: 1000
length of FACTVALUE: 449
### benchmark <ruby>
# running test "dec2fact"
time bash -c 'for i in $(seq 2000) ; do factoradic --d2f "9876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210" >/dev/null ; done'
real 4m19.681s
user 3m52.694s
sys 0m24.535s
# running test "fact2dec"
time bash -c 'for i in $(seq 2000) ; do factoradic --f2d -s ',' "256,181,382,250,417,105,148,94,220,219,290,193,126,393,317,38,359,351,21,230,317,226,298,315,206,364,34,285,21,327,187,336,266,0,334,231,82,309,248,305,300,102,201,321,315,105,36,155,146,81,120,158,24,227,156,284,364,219,157,319,202,309,355,198,126,78,353,247,220,9,152,81,237,122,91,5,345,206,181,93,257,280,231,57,288,314,316,93,193,360,239,196,341,333,56,91,325,3,204,289,320,280,80,173,314,211,322,53,39,105,151,227,237,107,42,95,300,161,263,60,294,39,108,32,132,181,290,43,315,211,8,30,155,224,30,252,73,110,65,157,63,177,236,32,173,201,94,166,108,215,249,125,101,77,10,153,155,222,110,9,154,66,209,27,184,102,43,206,13,178,120,185,162,112,214,37,50,32,188,255,151,107,156,184,180,51,215,8,10,54,248,173,170,233,46,228,187,35,238,212,101,221,73,115,188,111,99,32,241,40,211,121,223,21,131,96,121,123,180,32,222,142,174,140,193,182,145,167,115,59,205,107,188,178,195,52,48,67,191,172,204,122,206,199,1,34,167,44,156,180,83,149,156,53,116,157,130,52,43,91,172,22,70,87,149,104,34,178,115,86,71,86,112,136,94,171,137,74,159,129,118,57,18,145,112,51,4,78,116,57,108,7,41,14,84,148,90,8,143,110,66,89,140,83,88,4,105,12,82,73,89,63,6,94,12,61,14,92,88,95,86,54,120,61,6,3,9,122,39,45,86,2,56,49,68,31,85,9,64,50,32,58,32,48,64,62,72,68,77,36,15,73,77,49,20,19,11,84,81,74,54,54,33,25,18,35,56,57,62,19,22,47,23,13,53,36,28,60,49,11,24,28,9,66,35,43,9,60,6,29,40,13,9,36,8,48,36,44,38,25,29,19,42,26,41,7,26,10,25,4,17,0,20,3,9,5,30,20,4,8,11,8,19,4,20,8,7,10,16,18,13,16,9,2,0,9,12,3,3,4,7,0,7,4,0,3,3,0,0,0" >/dev/null ; done'
real 5m39.451s
user 5m9.966s
sys 0m26.614s
### benchmark <C> variations
### benchmark <C: gcc> CC='gcc'
# cleaning existing configuration...
make distclean
# configuring build to use "gcc" as the compiler...
./configure --disable-debug --disable-assert CC=gcc
# building
make
# running test "dec2fact"
time bash -c 'for i in $(seq 2000) ; do ./dec2fact "9876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210" >/dev/null ; done'
real 0m1.729s
user 0m0.092s
sys 0m0.160s
# running test "fact2dec"
time bash -c 'for i in $(seq 2000) ; do ./fact2dec "256,181,382,250,417,105,148,94,220,219,290,193,126,393,317,38,359,351,21,230,317,226,298,315,206,364,34,285,21,327,187,336,266,0,334,231,82,309,248,305,300,102,201,321,315,105,36,155,146,81,120,158,24,227,156,284,364,219,157,319,202,309,355,198,126,78,353,247,220,9,152,81,237,122,91,5,345,206,181,93,257,280,231,57,288,314,316,93,193,360,239,196,341,333,56,91,325,3,204,289,320,280,80,173,314,211,322,53,39,105,151,227,237,107,42,95,300,161,263,60,294,39,108,32,132,181,290,43,315,211,8,30,155,224,30,252,73,110,65,157,63,177,236,32,173,201,94,166,108,215,249,125,101,77,10,153,155,222,110,9,154,66,209,27,184,102,43,206,13,178,120,185,162,112,214,37,50,32,188,255,151,107,156,184,180,51,215,8,10,54,248,173,170,233,46,228,187,35,238,212,101,221,73,115,188,111,99,32,241,40,211,121,223,21,131,96,121,123,180,32,222,142,174,140,193,182,145,167,115,59,205,107,188,178,195,52,48,67,191,172,204,122,206,199,1,34,167,44,156,180,83,149,156,53,116,157,130,52,43,91,172,22,70,87,149,104,34,178,115,86,71,86,112,136,94,171,137,74,159,129,118,57,18,145,112,51,4,78,116,57,108,7,41,14,84,148,90,8,143,110,66,89,140,83,88,4,105,12,82,73,89,63,6,94,12,61,14,92,88,95,86,54,120,61,6,3,9,122,39,45,86,2,56,49,68,31,85,9,64,50,32,58,32,48,64,62,72,68,77,36,15,73,77,49,20,19,11,84,81,74,54,54,33,25,18,35,56,57,62,19,22,47,23,13,53,36,28,60,49,11,24,28,9,66,35,43,9,60,6,29,40,13,9,36,8,48,36,44,38,25,29,19,42,26,41,7,26,10,25,4,17,0,20,3,9,5,30,20,4,8,11,8,19,4,20,8,7,10,16,18,13,16,9,2,0,9,12,3,3,4,7,0,7,4,0,3,3,0,0,0" >/dev/null ; done'
real 0m1.547s
user 0m0.128s
sys 0m0.157s
### benchmark <C: clang> CC='clang'
# cleaning existing configuration...
make distclean
# configuring build to use "clang" as the compiler...
./configure --disable-debug --disable-assert CC=clang
# building
make
# running test "dec2fact"
time bash -c 'for i in $(seq 2000) ; do ./dec2fact "9876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210987654321098765432109876543210" >/dev/null ; done'
real 0m1.726s
user 0m0.102s
sys 0m0.148s
# running test "fact2dec"
time bash -c 'for i in $(seq 2000) ; do ./fact2dec "256,181,382,250,417,105,148,94,220,219,290,193,126,393,317,38,359,351,21,230,317,226,298,315,206,364,34,285,21,327,187,336,266,0,334,231,82,309,248,305,300,102,201,321,315,105,36,155,146,81,120,158,24,227,156,284,364,219,157,319,202,309,355,198,126,78,353,247,220,9,152,81,237,122,91,5,345,206,181,93,257,280,231,57,288,314,316,93,193,360,239,196,341,333,56,91,325,3,204,289,320,280,80,173,314,211,322,53,39,105,151,227,237,107,42,95,300,161,263,60,294,39,108,32,132,181,290,43,315,211,8,30,155,224,30,252,73,110,65,157,63,177,236,32,173,201,94,166,108,215,249,125,101,77,10,153,155,222,110,9,154,66,209,27,184,102,43,206,13,178,120,185,162,112,214,37,50,32,188,255,151,107,156,184,180,51,215,8,10,54,248,173,170,233,46,228,187,35,238,212,101,221,73,115,188,111,99,32,241,40,211,121,223,21,131,96,121,123,180,32,222,142,174,140,193,182,145,167,115,59,205,107,188,178,195,52,48,67,191,172,204,122,206,199,1,34,167,44,156,180,83,149,156,53,116,157,130,52,43,91,172,22,70,87,149,104,34,178,115,86,71,86,112,136,94,171,137,74,159,129,118,57,18,145,112,51,4,78,116,57,108,7,41,14,84,148,90,8,143,110,66,89,140,83,88,4,105,12,82,73,89,63,6,94,12,61,14,92,88,95,86,54,120,61,6,3,9,122,39,45,86,2,56,49,68,31,85,9,64,50,32,58,32,48,64,62,72,68,77,36,15,73,77,49,20,19,11,84,81,74,54,54,33,25,18,35,56,57,62,19,22,47,23,13,53,36,28,60,49,11,24,28,9,66,35,43,9,60,6,29,40,13,9,36,8,48,36,44,38,25,29,19,42,26,41,7,26,10,25,4,17,0,20,3,9,5,30,20,4,8,11,8,19,4,20,8,7,10,16,18,13,16,9,2,0,9,12,3,3,4,7,0,7,4,0,3,3,0,0,0" >/dev/null ; done'
real 0m1.544s
user 0m0.132s
sys 0m0.151s
### end of benchmarks