The fastest Z80 instructions are 4 clock cycles, at least 7 clock cycles if they also need to load or store an 8-bit value from/to memory, and at least 10 clock cycles for instructions that load or store a 16-bit value.
I did a little deep dive into Z80 timings a little while ago using the Z80 netlist simulation from visual6502.org:
https://floooh.github.io/2021/12/06/z80-instruction-timing.h...
But for BASIC programs those timings don't matter much, since BASIC on 8-bit home computers was easily 100x times slower than assembly code doing the same thing (the difference is probably less though when floating point math is involved, since this also needs to be 'software-emulated' in assembly).
...except that the BBC BASIC was giving me Heisenbugs, so I had to give up on it. So I'm on Forth now, and immediately found that Forth is a more productive environment than an early BASIC anyway. Linenums add a killer amount of bookkeeping.
BASIC on ZX Spectrum was meant for learning, but no serious software of the era relied on it for anything that needed to run fast.
I suspect this code could be 10x faster if written in assembly or a compiled language (a handful existed for the platform).
https://spectrumcomputing.co.uk/entry/8249/ZX-Spectrum/HiSof...
The manual:
And we'll waste all these cycles on JavaScript.
Actually, it's much, much slower than that.
The Z80 takes at least one clock cycle to add or subtract an 8-bit number (sometimes several clock cycles, depending on addressing mode). For a 32-bit number those clock cycles add up quickly.
In contrast, a modern 3.5GHz CPU can add or subtract several 64-bit numbers every clock cycle
And don't get me started on multiplication or floating-point arithmetic. A modern CPU would be thousands times faster, even if it was running at the same clock speed.
Thus, I think that the feat is even more impressive than presented!