Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```rb
- print 'cos '; puts Benchmark.realtime { 10000000.times { Math.cos 1 }}
- print 'sin '; puts Benchmark.realtime { 10000000.times { Math.sin 1 }}
- print 'tan '; puts Benchmark.realtime { 10000000.times { Math.tan 1 }}
- print 'acos '; puts Benchmark.realtime { 10000000.times { Math.acos 1 }}
- print 'asin '; puts Benchmark.realtime { 10000000.times { Math.asin 1 }}
- print 'atan '; puts Benchmark.realtime { 10000000.times { Math.atan 1 }}
- print 'cosh '; puts Benchmark.realtime { 10000000.times { Math.cosh 1 }}
- print 'sinh '; puts Benchmark.realtime { 10000000.times { Math.sinh 1 }}
- print 'tanh '; puts Benchmark.realtime { 10000000.times { Math.tanh 1 }}
- print 'acosh '; puts Benchmark.realtime { 10000000.times { Math.acosh 1 }}
- print 'asinh '; puts Benchmark.realtime { 10000000.times { Math.asinh 1 }}
- print 'atanh '; puts Benchmark.realtime { 10000000.times { Math.atanh 1 }}
- print 'exp '; puts Benchmark.realtime { 10000000.times { Math.exp 1 }}
- print 'log '; puts Benchmark.realtime { 10000000.times { Math.log 1, 1 }}
- print 'log2 '; puts Benchmark.realtime { 10000000.times { Math.log2 1 }}
- print 'log10 '; puts Benchmark.realtime { 10000000.times { Math.log10 1 }}
- print 'sqrt '; puts Benchmark.realtime { 10000000.times { Math.sqrt 1 }}
- print 'cbrt '; puts Benchmark.realtime { 10000000.times { Math.cbrt 1 }}
- print 'frexp '; puts Benchmark.realtime { 10000000.times { Math.frexp 1 }}
- print 'ldexp '; puts Benchmark.realtime { 10000000.times { Math.ldexp 1, 1 }}
- print 'hypot '; puts Benchmark.realtime { 10000000.times { Math.hypot 1, 1 }}
- print 'erf '; puts Benchmark.realtime { 10000000.times { Math.erf 1 }}
- print 'erfc '; puts Benchmark.realtime { 10000000.times { Math.erfc 1 }}
- print 'gamma '; puts Benchmark.realtime { 10000000.times { Math.gamma 1 }}
- print 'lgamma '; puts Benchmark.realtime { 10000000.times { Math.lgamma 1 }}
- print 'cbrt '; puts Benchmark.realtime { 10000000.times { Math.cbrt 1 }}
- print 'atan2 '; puts Benchmark.realtime { 10000000.times { Math.atan2 1, 1 }}
- ```
- ```
- :Func :Before :After
- cos 4.254130927001825 1.4405686919926666
- sin 4.291027050989214 1.4243739590019686
- tan 5.363125992007554 1.483381660989835
- acos 4.32658559900301 1.2158808639942436
- asin 4.435602433994063 1.186041908003972
- atan 5.748181078990456 1.365189026997541
- cosh 4.990852664006525 1.2583572969888337
- sinh 4.523930807001307 1.29845637800463
- tanh 4.194435634999536 1.262307046999922
- acosh 4.406813007997698 1.236766300004092
- asinh 4.644120037002722 1.7610739079973428
- atanh 4.88491953999619 1.5865220309933648
- exp 4.4360210559971165 1.262295284002903
- log 8.53709495300427 2.3806999689986696
- log2 4.5818921600002795 1.3234373809973476
- log10 4.361282436992042 1.306003783000051
- sqrt 4.195985846003168 1.1582538549992023
- cbrt 4.281482355989283 1.3084301960043376
- frexp 4.681357052002568 1.7626637079956708
- ldexp 4.358438926996314 1.3060880839911988
- hypot 7.374471293005627 1.348440486995969
- erf 4.596977610999602 1.6560243620042456
- erfc 4.516037146997405 1.5825385909993201
- gamma 4.0430225580057595 1.194721624997328
- lgamma 4.750712952998583 1.8684836480097147
- cbrt 4.055364069994539 1.2893988039868418
- atan2 7.793055543996161 1.355327188008232
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement