Standard Lib ceil() is Slower by 2-3%
include bench.e
include euslibs_math.e
include math.e
sequence p
p = {}
set_bench_timer(3) -- want 3-second tests
add_test("Standard Lib ceil()",routine_id("ceil"))
add_test("EusLibs ceil()",routine_id("euslibs_ceil"))
set_bench_parameter( {{3.2,-4.7,6.8,19.23,21}} )
run_tests() -- first test with 5 elements
for t=1 to 10000 do
p &= rand(10000) / 100
end for
set_bench_parameter( {p} )
run_tests() -- second test with 10000 elements
Typical results from running a benchmark:
Final Results:
EusLibs ceil() - 2232042 <-- Fastest!
Standard Lib ceil() - 2159694 <-- Slower by 3.241337%
The EusLibs ceil() is just -floor(-a).
I guess floor() is a Speedy Gonzalez, eh? :)
|
Not Categorized, Please Help
|
|