newlisp/qa-specific-tests/qa-bigint-bench

65 lines
2.8 KiB
Text
Executable file

#!/usr/bin/env newlisp
(set 'x1 12345678901234567890L)
(set 'y1 1234567890L)
(set 'x2 1234567890123456789012345678901234567890L)
(set 'y2 12345678901234567890L)
(set 'x3 123456789012345678901234567890123456789012345678901234567890L)
(set 'y3 123456789012345678901234567890L)
(set 'x4 12345678901234567890123456789012345678901234567890123456789012345678901234567890L)
(set 'y4 1234567890123456789012345678901234567890L)
(set 'x5 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890L)
(set 'y5 12345678901234567890123456789012345678901234567890L)
(set 'x6 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890L)
(set 'x7 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890L)
(set 'x8 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890L)
(set 'x9 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890L)
(set 'start-time (time-of-day))
(println " 20+10 " (time (+ x1 y1) 1000000))
(println " 40+20 " (time (+ x2 y2) 1000000))
(println " 60+30 " (time (+ x3 y3) 1000000))
(println " 80+40 " (time (+ x4 y4) 1000000))
(println "100+50 " (time (+ x5 y5) 1000000))
(println)
(println " 20-10 " (time (- x1 y1) 1000000))
(println " 40-20 " (time (- x2 y2) 1000000))
(println " 60-30 " (time (- x3 y3) 1000000))
(println " 80-40 " (time (- x4 y4) 1000000))
(println "100-50 " (time (- x5 y5) 1000000))
(println)
(println " 20*10 " (time (* x1 y1) 1000000))
(println " 40*20 " (time (* x2 y2) 1000000))
(println " 60*30 " (time (* x3 y3) 1000000))
(println " 80*40 " (time (* x4 y4) 1000000))
(println "100*50 " (time (* x5 y5) 1000000))
(println)
(println " 20/10 " (time (/ x1 y1) 1000000))
(println " 40/20 " (time (/ x2 y2) 1000000))
(println " 60/30 " (time (/ x3 y3) 1000000))
(println " 80/40 " (time (/ x4 y4) 1000000))
(println "100/50 " (time (/ x5 y5) 1000000))
(println)
(println "100+100 " (time (+ x5 x5) 1000000))
(println "100-100 " (time (- x5 x5) 1000000))
(println "100*100 " (time (* x5 x5) 1000000))
(println "100/100 " (time (/ x5 x5) 1000000))
(println)
(println " 20*20 " (time (* x1 x1) 1000000))
(println " 40*40 " (time (* x2 x2) 1000000))
(println " 60*60 " (time (* x3 x3) 1000000))
(println " 80*80 " (time (* x4 x4) 1000000))
(println "100*100 " (time (* x5 x5) 1000000))
(println "120*120 " (time (* x6 x6) 1000000))
(println "140*140 " (time (* x7 x7) 1000000))
(println "160*160 " (time (* x8 x8) 1000000))
(println "200*200 " (time (* x9 x9) 1000000))
(println "\ntotal time: " (- (time-of-day) start-time) "ms")
(exit)