A pretty pointless 'test' there. I suppose it has some value in demonstrating that you can handle large numbers without collapsing into floats when needed.
Yes, mostly useless. Like many such benchmarks/examples/challenges. Mostly for fun. I learned a few things along the way.
As I have said a few times already: While the fibo(4784969) challenge requires producing a million digit result, big integers are not the main point. The point was to require an algorithm that is not to complex but not too trivial so as to show off how easy it is to write in a language, how easy it is for others to read and understand. It's about expressiveness , comprehensibility, elegance, aesthetics. Performance is a secondary concern.
I think you may have missed a point, collapsing to regular floats for big numbers will not produce the correct result.
Performance-wise that code sucks. Am I bothered? Guess. There's an awful lot of more important factors in the value of a language.
Yes exactly. See above.
Now, about your benchFib example above:
1) Could you explain what all that line noise means? Perhaps it's me but it's unintelligible. If I squint hard I can just about make out a recursive fibo in there.
2) How do I run it? It fails for me:
Code: Select all
$ cat fibo.st
benchFib "Handy send-heavy benchmark"
"(result // seconds to run) = approx calls per second"
" | r t |
t := Time millisecondsToRun: [r := 26 benchFib].
(r * 1000) // t"
"138000 on a Mac 8100/100 in 1996. 19,000,000 on a Pi3 in 2018"
^ self < 2
ifFalse: [(self-1) benchFib + (self-2) benchFib + 1]
$ gst fibo.st
Object: nil error: did not understand #<
UndefinedObject(Object)>>doesNotUnderstand: #< (SysExcept.st:1448)