A brand new calculator benchmark: "middle square method seed test" - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: A brand new calculator benchmark: "middle square method seed test" (/thread-249996.html) |
A brand new calculator benchmark: "middle square method seed test" - Pier Aiello - 09-10-2013 I have written it directly on wiki4hp (and sorry for my english, i hope that others editors will fix it)
Here i copy only the pseudocode of the test: k:= a number > 0 Again, i hope that the admin of wiki4hp will be more tolerant, so users can edit directly the wiki page.
Oh, my hp50g is crunching the test with k=2 and several minutes have already passed. Edited: 10 Sept 2013, 7:26 p.m.
Re: A brand new calculator benchmark: "middle square method seed test" - Bruce Bergman - 09-10-2013 Great job on putting these up in a central place, Pier! I contacted you offline about the wiki, so check your mail. :-) Thanks,
Bruce
Re: A brand new calculator benchmark: "middle square method seed test" - Pier Aiello - 09-11-2013 Email checked ;) About the benchmark, my hp50g is in trouble!! The smallest input, 100 (or 100^k with k=1), have a complexity of O(100*100) in terms of repeated cycles. It, anyway, has finished in 24 secs. But with 100^2, we have a complexity of O(100^2*100^2=100^4), that is 100^2 times the previous one. So 24*100^2 = 240.000 secs = several days. Now i'm keep it crunching (thanks to usb hubs that can be coupled with a small power supply [a nokia one, for example], so they are can give current even without a computer), but i guess that the 100^2 input is only for faster version/devices. Maybe an HPGCC version can do it in several minutes. I'm curious about a HP50g with HPGCC / Wp34s / HP39gII / HP prime / TI 89 with TIGCC / TI nspire versions.
While i guess that previous calculators can solve, in less than an hour, only the 100^1 input.
Re: A brand new calculator benchmark: "middle square method seed test" - Gilles Carpentier - 09-11-2013 Hi Pier
Could you explain what this program do ?
What sequenceIsConvergent and limitCyclicSequences means?
Re: A brand new calculator benchmark: "middle square method seed test" - Pier Aiello - 09-11-2013 Of course, and i use wikipedia for this (since it was my main source (1)). Given the notions in the Middle-square Wikipedia article we have that the middle square method has a lot of flaws because the sequence can be convergent or cyclic really fast. An example:
Let k=1 , so we have as reference n:= 100^k = 100 (1) I want to design a "simple" benchmark, so i thought about the extraction of numbers from a random sequence, or better, from decimals of transcendental numbers. So i stumbled on Bailey–Borwein–Plouffe formula, but it is a bit complex so i prefer a simpler method.
(2)Yes, i miss the phrase For a generator of n-digit numbers the period can be no longer than 8^n, now it is late and moreover this is a benchmark so the more computations, the better challenge for fast calculators. Edited: 11 Sept 2013, 8:05 p.m. after one or more responses were posted
Re: A brand new calculator benchmark: "middle square method seed test" - Marcel Samek - 09-11-2013 I think that using this particular problem as a general purpose benchmarks for calculators is somewhat problematic.
The reason I think so is that it focuses on integer manipulation and digit twiddling and not all calculators have comparable instruction sets to do these operations. While I am sure that I could code this up on pretty much any calculator, on a 15C, for example, where there are only floating point operations, the code would be So, what does a benchmark like this compare? For one it compares the cleverness of the programmer on different platforms, but that isn't really the point. What you really want is a benchmark that can be implemented in a comparable way on various platforms so that you can actually compare the performance of the target in executing the comparable code. When the code starts looking very different on different platforms, you are not really comparing the performance of the platform, but rather the suitability of the platform to a particular type of problem.
While some calculators have integer and bit operations, pretty much all of them have floating point operations, and all of them have trigonometric functions, etc. and it seems to me that a non-trivial benchmark that focuses on what they have in common, rather than what they don't, would be of more value.
Re: A brand new calculator benchmark: "middle square method seed test" - Pier Aiello - 09-11-2013 Yeah, you are right. But i thought that the entire benchmark, even if rewards the ability of the programmer plus the math framework of the calculator, have as target calculators like 48 series and its successors (so with an extended mathematical framework).
But anyway, you are still right, i'll write ASAP another benchmark, that is based on prime numbers without any memory use. It's a plain stupid one: new number, start dividing it by 2,3,... (using modulo, or a user function that simulate it) it is prime? Yes, else check then next one. Edited: 11 Sept 2013, 7:54 p.m.
New "simpler" benchmark: Ultra naive search for primes - Pier Aiello - 09-11-2013 As Marcel Samek on 11 Sept 2013 pointed out, the middle square test don't fit in programmable calculators with limited mathematical framework about floor/ceiling functions and manipulating digits. So, there is a new simpler, but anyway tough, benchmark: "Ultra naive search for primes" .
The code is: input: n
The result format is: A result is composed by the following list
The options are n:= 100
PS: i can't add the hp50g values now, since it is still crunching the middle square test with k:=2
Re: New "simpler" benchmark: Ultra naive search for primes - Pier Aiello - 09-12-2013 Ok, Casio's guys are really kind and i'm starting to gather some results (on primz for example). Primz is almost 2x faster than 50g (at least the hp50g with my userRPL that is very simple) even if it has not so much memory. While Ti community is still idle (as well as HP one. Lend me some calculators!)
I have added also some results of smartphones (using python) that are powerful but not extremely powerful as today ones. I think that cheap or mid level smartphones of 2004-2010, with scripting language like python, can be matched by newer calculators as nspire/prime as well as C implementations on hp50g/casios/ti-8x .
Even newer devices (released after 2010) with emulators of calculators or mathematical frameworks (math studio / spacetime for example, free42, droid48, etc. ) can't do so better, in my opinion than the stuff cited previously.
Re: New "simpler" benchmark: Ultra naive search for primes - Gilles Carpentier - 09-12-2013 Prime Result (Hdw rev 5106 )
EXPORT Bench1(n) TIME(Bench1(100)) -> 0.52 sec TYPO EDIT It's 0.052s TIME(Bench1(1000)) -> 2.762 sec
TIME(Bench1(10000)) -> 202.112 sec Edited: 13 Sept 2013, 7:26 a.m. after one or more responses were posted
Re: New "simpler" benchmark: Ultra naive search for primes - Gilles Carpentier - 09-12-2013 "PS: i can't add the hp50g values now, since it is still crunching the middle square test with k:=2 "
I hope you connect it to the USB port to avoid draining the batteries ;)
Re: New "simpler" benchmark: Ultra naive search for primes - Pier Aiello - 09-12-2013 Thanks! I'll add it now but anyway the prizm has done an unbelievable result! It is way faster than the palm treo pro and nokia e5 (both with python that is like lua/modula on TIs, CASIOs and HPs). And, so, it is way faster than Prime. I'm wating for a "revenge" by Hp50 with HPGCC, hp39gii & prime with C (if it exists); and of course for nspires/ti-8X.
edit: So is not only a matter of MHZ + emulation (as in Hp50g).
Edited: 12 Sept 2013, 4:08 p.m.
Re: New "simpler" benchmark: Ultra naive search for primes - Pier Aiello - 09-12-2013 Sure it was connected! (i interrupted the operation after 48 hours). Now it has just done the ultranaiveprimes for n=10'000. 40'000 secs :P
Re: New "simpler" benchmark: Ultra naive search for primes - Pier Aiello - 09-12-2013 Maybe for n=100 is 0.052? It seems too slow :/
Re: New "simpler" benchmark: Ultra naive search for primes - Tim Wessman - 09-12-2013 I got:
100->.052s So yeah, think it is missing a 0. Also, I changed it to be K MOD J == 0 to match closer the given code. Seems to also actually reduce the times some.
100->.047_s Seems to slot it right around a 50g running the more efficent saturn ASM code. Also, out of curiosity you should ask over in the casio forum if they have any way to do a *native* numerical calculation instead of a pure C int calculation in the C program. It would be interesting to see the casio math library MOD function used instead with the user number object instead of a pure integer for comparison. TW
Edited: 12 Sept 2013, 7:27 p.m.
Re: New "simpler" benchmark: Ultra naive search for primes - Pier Aiello - 09-13-2013 While i agree that prime is very fast just with basic tools, i must ask: is the saturn ASM emulated as well? If it is so, then is not so "efficient" (ok, is way better than userRPL, but i guess that hpgcc is both faster and more readable than a low level lang.) But what stunned me is what i wrote in message #12. I expected than a math device at the same speed (1) of a smartphone can overcome (or at least be on the same level) the latter by far in math things using an high level and quick language (as is scripting with modula or python). Why? Just because the interpreter/compiler on the math device should be "optimized" a lot for its hw. Instead the Prime is quite slow against pythonCE on a 400mhz cpu with WM6.1 , and i don't think that pythonCE was optimized for the palm treo hw. (of course the prime not needs to be extremely faster, in the end is a quick math tool)
(1) I'm aware that the speed doesn't count the cpu efficiency.
Re: New "simpler" benchmark: Ultra naive search for primes - Paul Dale - 09-13-2013 Quote: There are a lot of other issues beyond raw CPU speed involved here. A smart phone won't have a highly accurate, mostly correctly rounded decimal mathematics library. Accuracy costs CPU. A calculator must give the best answers it can all of the time. A phone needn't be so stringent.
Re: New "simpler" benchmark: Ultra naive search for primes - Pier Aiello - 09-13-2013 You are completely right. I always forget that a math model involves also accuracy, because i don't use so much smaller digits (even tough i'm aware of techniques of numerical analysis to get the maximum accuracy possible). Edited: 13 Sept 2013, 4:08 a.m.
Re: New "simpler" benchmark: Ultra naive search for primes - bhtooefr - 09-13-2013 That particular Treo also has an ARM11 versus the Prime's ARM9.
ARM's own specs would predict that the Treo would be about 14% faster on raw CPU power.
Re: New "simpler" benchmark: Ultra naive search for primes - Pier Aiello - 09-13-2013 Oh, i didn't know that. Thanks :)
Re: New "simpler" benchmark: Ultra naive search for primes - Gilles Carpentier - 09-13-2013 You're rigth. It's 0.052s and not 0.52
Re: New "simpler" benchmark: Ultra naive search for primes - Tim Wessman - 09-13-2013 BCD vs float... TW
Re: New "simpler" benchmark: Ultra naive search for primes - Pier Aiello - 09-13-2013 Oh, right. Nevermind then, and thanks for the hint (1)!
(1) For another aspect, this shows that the mathematical environment of a calculator is far better than a "cheap" environment on a smartphone when the correctness is needed..
593 million for summation bench - Pier Aiello - 09-13-2013 Arm asm solution of 3298 and List updated
Just to share :)
Re: New "simpler" benchmark: Ultra naive search for primes - Pier Aiello - 09-14-2013 The ARM ASM on HP50g has smashed both PRIZM and (early)smartphones with scripting languages.
Even tough coding more than simple operations with ASM is quite hard, but they can be a nester to speed up eventual code.
Re: New "simpler" benchmark: Ultra naive search for primes - Pier Aiello - 09-17-2013 A small update, finally a wild Nspire appears!!
n is 10'000 |