I'm pretty sure that Acorn versions of BBC BASIC, and possibly Brandy too, optimise the 'whole array' operations (like SUM(), which both the top two highest-scoring submissions use) more aggressively than my versions do. One reason for this, I suspect, is that the 'original' BBC BASIC v5 had only two numeric data types - 32-bit integer and 40-bit float - which meant it was perfectly sensible to code the functions independently for each type.Richard Russell wrote: ↑Sun 01 Feb 2026, 18:03 Brandy BASIC is also written in C and is much faster than mine, showing that there should be room for improvement.
But my 'modern' BASICs have more numeric types, including 8-bit unsigned integers, 64-bit signed integers, 64-bit and 80-bit floats. As a result I chose to implement SUM(), MOD() etc. more generically. They share the same code between the different data types and call the same general-purpose type-agnostic addition and multiplication routines at their heart.
But whilst this made them easier (and safer) to code they are significantly slower than would be the case if each data type had its own dedicated routines.