Choice of 32-bit or 64-bit BBC BASIC

Discussions related to the BB4W & BBCSDL interpreters and run-time engines
Richard Russell
Posts: 325
Joined: Tue 18 Jun 2024, 09:32

Choice of 32-bit or 64-bit BBC BASIC

Post by Richard Russell »

On platforms other than Windows, you often have no choice in respect of whether you run a 32-bit or 64-bit version of BBC BASIC. For example on MacOS and iOS only 64-bit apps are supported, 32-bit ones simply won't run.

On Android both 32-bit and 64-bit apps are currently still supported on most devices, but the 64-bit version will almost always be used in preference. So again you don't get to choose.

In Linux you can sometimes install a multiarch library to support running both 32-bit and 64-bit programs, but this isn't the default and many - probably most - users choose not to. Therefore it's usually a case of running the version of BBC BASIC which matches your OS.

Only in Windows do you still have a genuine 'choice', because all modern versions of Windows will run both 64-bit and 32-bit applications 'transparently', it just works. Which raises the question of which version of BBC BASIC you should run on Windows.

I generally recommend that you run the 32-bit version. There are a few reasons for this: the 32-bit interpreter is written in assembly language: it's smaller, faster and uses fewer system resources than the 64-bit version, which is coded in C.

If you're porting a program from another version of BASIC, for example BBC BASIC for Windows, it won't have been written with 64-bit operation in mind and therefore compatibility issues may arise if you run it in 64-bit BBC BASIC, requiring it to be modified.

But there is a counter-argument. If your program performs a lot of input/output, perhaps it is accessing some large data files, then you may find that the 64-bit version runs faster. This is likely to be because input/output may require a lot of switching between 32-bit and 64-bit CPU states.

So perhaps have both 32-bit and 64-bit versions available, which is what I do, so you can choose which is most appropriate for each program.
Richard Russell
Posts: 325
Joined: Tue 18 Jun 2024, 09:32

Re: Choice of 32-bit or 64-bit BBC BASIC

Post by Richard Russell »

Richard Russell wrote: Mon 24 Mar 2025, 18:45 I generally recommend that you run the 32-bit version. There are a few reasons for this: the 32-bit interpreter is written in assembly language: it's smaller, faster and uses fewer system resources than the 64-bit version, which is coded in C.
To put some figures on that, the timing.bbc program (in examples/tools) reported an average of 79 ns when running the 32-bit version and 86 ns when running the 64-bit version, on an Intel Core i7. Not a huge difference, but significant.

In contrast, the same program running natively on an 'Apple Silicon' M1 CPU (so that means BBCTTY, since BBCSDL runs under Rosetta 2 emulation on that platform) reported an average of 42 ns. And that's by no means the fastest Apple Mac currently available! :shock: