WP34S: Some operator timings  Printable Version + HP Forums (https://archived.hpcalc.org/museumforum) + Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum1.html) + Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum2.html) + Thread: WP34S: Some operator timings (/thread250342.html) 
WP34S: Some operator timings  Marcel Samek  09152013 Here is some data on operator speed. All of these were sampled at least 5 times (many were sampled 6 times) and below is the mean as well as the relative standard deviation of the samples. These were all performed in decimal, single precision mode with a stack depth of 4. To measure these I used a program that has a 30 second (using tick) loop with the operator being measured in the middle. I then run the same program with two of the operators in the loop, and then three of the operators, etc. The delta between adjacent runs measures the impact of adding a single operator to the loop. The raw data can be found in this spreadsheet: Libreoffice (OpenOffice?) Spreadsheet It seems that the actual value of the number can have a significant value on the speed of the operations. For example for the 4 basic operations, I tested once using just whole numbers (but not in integer mode) and once using random values generated by the random number function. For the the exponential functions, I use the value on the stack from the previous operation. This means that the range of values is huge and changes drastically. You can see that the impact that has on the relative standard deviation of the samples.
Operation Ops per second Milliseconds per op Relative Standard Dev Edited: 15 Sept 2013, 2:14 p.m.
Re: WP34S: Some operator timings  Pier Aiello  09152013 Nice! Can you do a wiki article about this?
Re: WP34S: Some operator timings  Paul Dale  09152013 Nice results. The CPU in the 30b is really good at shuffling data around. The number of digits in a number will impact the performance for the basic arithmetical operations. The decNumber library knows how many digits are in a number and doesn't process the trailing zeros. The library also has some shortcuts  e.g. multiplication by zero.
Re: WP34S: Some operator timings  Marcel Samek  09152013 I want to run analogous tests on the 15CLE and then I'll post the code and results all together.
Re: WP34S: Some operator timings  Marcel Samek  09152013 The trailing zero optimization seems to make quite a difference. One thing that I found striking is that if R[v] and R[^] are indicative, then a significant portion of the time spent in the basic math operations is the stack drop and the arithmetic itself is impressively fast.
Re: WP34S: Some operator timings  Paul Dale  09152013 I suspect the time is more in the interpretive overhead for the opcode dispatch. There is quite a lot that goes on there. The stack roll operations are a couple of memory copies which are quick. I'm not sure how to best test this. NOPs might work but they don't go through the entire dispatch sequence. Integer mode bitwise operations might be better.
