Benchmarking
Posted: Fri Oct 16, 2020 11:51 am
Always a highly debated topic and often falls into the "my processor is better than your processor" bun fight, however, having been involved in this area in the world of supercomputers for some time in the past I thought I'd put something here, based on what has been posted recently...
One of the key things is consistency, so over the years a set of standard benchmarks have been designed over the years and a fantastic source of the popular ones are held on Roy Longbottoms benchmark website: http://www.roylongbottom.org.uk/classic.htm however these are not that applicable to our beloved 8-bit CPU, but it still makes for good reading if you're interested in this field... (and as an aside; I worked on supercomputers in Livermore Labs for a while - home place of one of those benchmarks!)
Consistency extends to the number format too - if your system is integer only and the benchmark will run in the integer domain then it's highly likely to be faster than the same benchmark run on a system that uses floating point numbers. Most BASICs (and I mean the 8-bit CPU ones here) use 4 or 5 byte floating point format and worse, when you ask them for Integer variables convert them to floating point to do the calculations then back again! (Exceptions to this are Apple Integer BASIC and BBC BASIC when you use integer variables - BBC Basic will perform the entire calculation in integer mode if it can).
Another "cheat" to watch out for is BASICs (and other languages) that have special interpretation of some variables - BBC Basic has the 27 integer variables, from @% through Z% stored in a fixed memory location and are much faster to use than a generic name% variable. Other BASICS and interpreted languages may also have these features, so, again, consistency is key to make an accurate comparison..
Same for putting spaces in (interpreted) programs, and tricks like multiple statements per line and subroutines at the start of the program... There is a difference between having a consistent benchmark and showing off... (Which doesn't mean that you should never show off - but establish the baseline first)
Something that's popular and I've had on my website for a while, and gets used from time to time is a BASIC version of Mandelbrot. I adapted it from some that were online (and wrong!) and it's been used by quite a few people - often just as a demo if nothing else... I designed it to work in most generic "Microsoft style" BASICs - e.g. EhBASIC and Applesoft as well as BBC Basic without any changes - as consistency is as important as anything in this world, so it's not the most efficient algorithm, not the best code, but it works. I've attached the text version of the code as well as the output it produces (or should produce!)
An other "classic" benchmark, more aimed at the home PC is the Byte sieve benchmark - see https://en.wikipedia.org/wiki/Byte_Sieve
The one I mentioned earlier - Ackermann is here: https://en.wikipedia.org/wiki/Ackermann_function and the one mentioned earlier, the Tak or Takari is here: https://en.wikipedia.org/wiki/Tak_(function)
finally, a set of very simple BASIC benchmarks, popular (probably mostly in the UK) are the Rugg/Feldman benchmarks: https://en.wikipedia.org/wiki/Rugg/Feldman_benchmarks
Anyway, just some food for thought!
Cheers,
-Gordon
One of the key things is consistency, so over the years a set of standard benchmarks have been designed over the years and a fantastic source of the popular ones are held on Roy Longbottoms benchmark website: http://www.roylongbottom.org.uk/classic.htm however these are not that applicable to our beloved 8-bit CPU, but it still makes for good reading if you're interested in this field... (and as an aside; I worked on supercomputers in Livermore Labs for a while - home place of one of those benchmarks!)
Consistency extends to the number format too - if your system is integer only and the benchmark will run in the integer domain then it's highly likely to be faster than the same benchmark run on a system that uses floating point numbers. Most BASICs (and I mean the 8-bit CPU ones here) use 4 or 5 byte floating point format and worse, when you ask them for Integer variables convert them to floating point to do the calculations then back again! (Exceptions to this are Apple Integer BASIC and BBC BASIC when you use integer variables - BBC Basic will perform the entire calculation in integer mode if it can).
Another "cheat" to watch out for is BASICs (and other languages) that have special interpretation of some variables - BBC Basic has the 27 integer variables, from @% through Z% stored in a fixed memory location and are much faster to use than a generic name% variable. Other BASICS and interpreted languages may also have these features, so, again, consistency is key to make an accurate comparison..
Same for putting spaces in (interpreted) programs, and tricks like multiple statements per line and subroutines at the start of the program... There is a difference between having a consistent benchmark and showing off... (Which doesn't mean that you should never show off - but establish the baseline first)
Something that's popular and I've had on my website for a while, and gets used from time to time is a BASIC version of Mandelbrot. I adapted it from some that were online (and wrong!) and it's been used by quite a few people - often just as a demo if nothing else... I designed it to work in most generic "Microsoft style" BASICs - e.g. EhBASIC and Applesoft as well as BBC Basic without any changes - as consistency is as important as anything in this world, so it's not the most efficient algorithm, not the best code, but it works. I've attached the text version of the code as well as the output it produces (or should produce!)
An other "classic" benchmark, more aimed at the home PC is the Byte sieve benchmark - see https://en.wikipedia.org/wiki/Byte_Sieve
The one I mentioned earlier - Ackermann is here: https://en.wikipedia.org/wiki/Ackermann_function and the one mentioned earlier, the Tak or Takari is here: https://en.wikipedia.org/wiki/Tak_(function)
finally, a set of very simple BASIC benchmarks, popular (probably mostly in the UK) are the Rugg/Feldman benchmarks: https://en.wikipedia.org/wiki/Rugg/Feldman_benchmarks
Anyway, just some food for thought!
Cheers,
-Gordon