Timing for primitive operations in EUPHORIA
- Posted by SDPringle Jan 10, 2011
- 1125 views
Out of curiosity. I took to timing the amount of time it takes to do basic operations in EUPHORIA. Operations were things such as times, divide, floor division on integers and floating point numbers.
Terminology:
- short integers are 30-bit integers which are stored in a compact manner.
- Floating point numbers are stored in doubles and may not always have a fraction part
The test shows that a floating point addition takes more time than a function call. I turned off in-lining for this test. or_bits() with floating point numbers (really just integers stored in doubles) takes 9 to 11 times longer than or_bits() with short integers.
Sample Run Time: 6000 s The test was supposed to take 6000 s. Test really took: 187 s to complete. ROUTINES Time to run a function call: 47 ±0 ns Time to run a procedure 22 ±0 ns SEQUENCE OPERATIONS Time to form a two element sequence 11 ±0 ns FLOATING POINT Time to do an addition 62 ±2 ns Time to do an multiplication : 55 ±1 ns Time to do a complex multiplication : 625 ±0 ns Time to exponentiate : 282 ±8 ns Time to run sine function call: 100 ±1 ns Time to run or_bits function call with a double 137 ±3 Time to divide two doubles 75 ±4 SMALL INTEGER Time to do add two integers: 7 ±0 ns Time to do multiply two integers: 10 ±0 ns Time to do floor divide two integers: 23 ±0 ns Time to do or_bits with integers: 7 ±0 ns Time to add two long sequences of integers: 909 ±31 ns ROUTINES Time to run a function call: 6.6 ±0.01 x Time to run a procedure 3.1 ±0.01 x SEQUENCE OPERATIONS Time to form a two element sequence 1.5 ±0.00 x FLOATING POINT Time to do an addition 9 ±0.22 x Time to do an multiplication : 7.6 ±0.12 x Time to do a complex multiplication : 87.3 ±0.00 x Time to exponentiate : 39.5 ±1.13 x Time to run sine function call: 14.0 ±0.16 x Time to run or_bits function call with a double: 19.1 ±0.36 x Time to divide two doubles 10.5 ±0.52 x SMALL INTEGER Time to do add two integers: 1.0 ±0.00 x Time to do multiply two integers: 1.4 ±0.00 x Time to do floor divide two integers: 3.3 ±0.01 x Time to do or_bits with integers: 1.0 ±0.02 x Time to add two long integer sequences: 127.0 ±4.39 x