User Tools

Site Tools


benchmarks:four_op_and_accuracy

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
benchmarks:four_op_and_accuracy [2013/09/13 15:49]
pier4r
benchmarks:four_op_and_accuracy [2013/09/13 15:52] (current)
pier4r
Line 1: Line 1:
 +====== Calc bench: Four operators (FO) ======
  
 +**The idea** \\
 +There are a lot of benchmarks for calculators and computers, but so far the popular ones are: 
 +  * [[benchmarks:​savage|Savage benchmark]] ( See also (([[resources:​bestofdiscussions|Entries in the best of list]].)) )
 +  * [[benchmarks:​nqueens|Nqueens with n=8]]
 +  * [[benchmarks:​addloop|Max sum in one minute]]
 +  * [[benchmarks:​ultranaiveprimes|Find primes in a naive way]]
 +Nquees tests mainly memory and addition-subtraction operators. The savage one is more complex and math related, but the results are scattered everywhere (Feel free to gather them and do a wiki page about it! Oh, we have already done that) plus it accounts "​only"​ the accuracy ((As if it is not important! Is a main topic on computation!)) so we don't have execution times. The summation test is really simple as well the find primes, even if the latter involves more operators. Moreover a test should be simple, else the userbase won't do it. (See the poor [[benchmarks:​middlesquare|middle square method test]] )
 +
 +So, why do we not do a simple benchmark involving the four operations (plus one, the square root) to check both the speed on simple operations and the accuracy? About accuracy, read below.
 +
 +**The pseudocode**
 +<​code>​
 +input: given an n
 +----
 +sum = 0;
 +b = 0; c = 0;
 +for a:=1 to n do {
 +  //to avoid optimizations by smarter compilers
 +  //trick them with new variables
 +  b:= a;
 +  c:= a;
 +  sum:= sum + squareRoot(b*c)/​a;​ //it's a sum+1 from the simbolic point of view.
 +}
 +print sum
 +</​code>​
 +
 +**What do we check?** \\
 +Both times of execution, for a given n, and accuracy (the result should be: n itself) in terms of relative error |result-n|/​n. Some arguments on the [[benchmarks:​nqueens|Savage benchmark]] **has shown that the accuracy measure is not so reliable**, so we don't check that (anyway, just report the result).
 +
 +**How to report the results**
 +<​code>​
 +A result is composed by the following list
 +- the device used plus the language used, eventual overclock, eventual custom firmware and so on.
 +- time elapsed for a given n in seconds (see below)
 +- the result printed
 +- the code used.
 +
 +N options:
 +100
 +1000
 +10'000
 +for fast implementations
 +100'​000
 +1'​000'​000
 +
 +if the calculator is too slow, or limited, to compute a given n, then report "for n the computation
 +takes too much time". Conversely, if the calculator is too fast to compute a given n, then report ​
 +"for n the computation takes too little time, i skipped it"
 +</​code>​
 +
 +===== Speed section =====
 +
 +==== Physical calculators ====
 +
 +=== n is 100 ===
 +  - HP 50g userRPL
 +    * 1.06 @75mhz
 +    * Res: 5050
 +    * code: ((<​code>​
 +<<
 +  @n
 +  0 @sum
 +  \->
 +  n
 +  sum
 +  <<
 +    PUSH
 +    -105 SF
 +
 +    1 n
 +    FOR a
 +      a DUP * @a^2
 +      \v/ @sqrt(a^2)
 +      '​sum'​ STO+
 +    NEXT
 +    sum
 +
 +    POP
 +  >>
 +>>
 +<​code>​))
 +
 +=== n is 1'000 ===
 +  - HP 50g userRPL
 +    * 10.01 @75mhz
 +    * Res: 500500
 +    * same of entry with n=100
 +
 +=== n is 10'000 ===
 +  - HP 50g userRPL
 +    * 102.093 @75mhz
 +    * Res: 50005000
 +    * same of entry with n=100
 +
 +=== n is 100'​000 ===
 +
 +=== n is 1'​000'​000 ===
 +
 +==== Emulators on mobile/​handheld devices smaller than 7''​ (7''​ included) ====
 +
 +=== n is 100 ===
 +
 +=== n is 1'000 ===
 +
 +=== n is 10'000 ===
 +
 +=== n is 100'​000 ===
benchmarks/four_op_and_accuracy.txt · Last modified: 2013/09/13 15:52 by pier4r