timrowledge wrote:A quickly hacked out version of this takes 1.7sec on Squeak on my pi.
At 1.7 seconds.. considerably faster. I wonder why.. is that compiled or interpreted Tim?
timrowledge wrote:A quickly hacked out version of this takes 1.7sec on Squeak on my pi.
Markodius wrote:timrowledge wrote:A quickly hacked out version of this takes 1.7sec on Squeak on my pi.
At 1.7 seconds.. considerably faster. I wonder why.. is that compiled or interpreted Tim?
DEFFNa(m%,n%)
IF m% ELSE =n%+1
IF n% ELSE =FNa(m%-1,1)
=FNa(m%-1,FNa(m%,n%-1)DEFFNa(m%,n%)
CASE m% OF
WHEN 0:=n%+1
WHEN 1:=n%+2
WHEN 2:=2*n%+3
WHEN 3:=2^(n%+3)-3
WHEN 4:j%=2:FOR i%=0 TO n%:j%=2^j%:NEXT i%:=j%-3
ENDCASE
=n%At 1.7 seconds.. considerably faster. I wonder why.. is that compiled or interpreted Tim?
DavidS wrote:The problem with the Ackermann algorithm is that it tests recursion, this has always been one of the shortcomings of 99% of BASIC interpreters, due to the way they pass parameters to functions/procedures. Hence the other tests that I suggested, these will speak to the standard libraries of BASIC as well as how efficient it is at making system calls. As to a good all around benchmark of an interpreted programming language, due to the differences in languages I do not think that there is one.
AMcS wrote:In the real world BASIC could be asked to something recursive (like Ackermann), so it's as valid a test as any other (we can't always just use algorithms that suit BASIC can we ?).
DEFFNa(m%,n%)
PROCa(m%)
=n%
DEFPROCa(m%)
WHILE m%
IF n% THEN n%-=1:PROCa(m%) ELSE n%=1
m%-=1
ENDWHILE
n%+=1
ENDPROC
rurwin wrote:There are cases where recursion is the right solution.
DavidS wrote:And recursion is rarely (if ever) as deep as the Ackermann algorithm.
David S said
Recursion is very useful
pygmy_giant said:David S said
Recursion is very useful
[pygmy_giant said:pygmy_giant said:David S said
Recursion is very useful
pygmy_giant said:pygmy_giant said:David S said
Recursion is very useful
tufty wrote:If anyone is using a bubble sort in the real world, they want a kick up the rear.
Markodius wrote:... What puzzles me most about it is why DavidS's raspi significantly outperforms mine when Ackermanning. Are you sneakily underclocking something DavidS? S'bliddy clever!
AMcS wrote:tufty wrote:If anyone is using a bubble sort in the real world, they want a kick up the rear.
Yes, true, but having students investigate the Bubble Sort ... is still a useful exercise IMHO ... they'll soon find that it's useless ...
NigelJK wrote:I always used a bubble sort to get a good idea of real world performance.
tufty wrote:AMcS wrote:tufty wrote:If anyone is using a bubble sort in the real world, they want a kick up the rear.
Yes, true, but having students investigate the Bubble Sort ... is still a useful exercise IMHO ... they'll soon find that it's useless ...
Oh, absolutely. However, my comment was in response to the following, which made me(my emphasis)
NigelJK wrote:I always used a bubble sort to get a good idea of real world performance.
Markodius wrote:Thanks for Ackermann 's because I'd never even heard of it. What puzzles me most about it is why DavidS's raspi significantly outperforms mine when Ackermanning. Are you sneakily underclocking something DavidS? S'bliddy clever!
Ackermann's as benchmark reflects stack efficacy? Riscos performs how well in that respect to other OS? It does seem best though, in programming terms, to curb recursion when possible.