A New Approach

When you define a Fast Variable, two new words are generated, providing faster access to the variable:

A "peeker" word: FRED@ ( -- n ) - fetches the value stored in FRED.

Functionally the same as FRED @ but only one pass through the inner interpreter. Compiles to two bytes.

A "poker word": FRED! ( n -- ) - stores a value in FRED.

Same as FRED ! but, again, only one pass through the inner interpreter. Compiles to two bytes.

So, the above example, which is 8 bytes and three passes through inner interpreter can be reduced to:

100 FRED!

6 bytes, and two passes through NEXT. It's also 30% faster.

Let's look at a fetch:

FRED @

4 bytes. Two passes through the interpreter. This reduces to:

FRED@

2 bytes, one pass through NEXT. Also 30% faster.

The Code

Here's the code to implement Fast Variables. As written the code occupies 188 bytes and requires no buffers or variables. The "peeker" and "poker" words that it creates for you are machine code words. They're tiny and fast. Enjoy.