#atlast #forthlang vs #micropython speed test on #esp32

A week or so ago I started out porting John Walker’s public domain Atlast Forth over to the Arduino. The code is highly portable, so who knows, maybe I’d get something going for the Uno, and maybe even the ATTiny85. Maybe.

I thought I’d do a little speed comparison to see if Atlast had any point at all to it. Micropython is an excellent and mature platform for microcontrollers, and is vastly superior to my own humble effort.

Anyway, do the speed test is to read a pin 20 times in a row and see how long it took.

The code on Micropython:

def fn():
    for i in range(20):

That took 845us (microseconds).

Here’s the equivalent code using atlast:

: t 20 0 do 23 digr drop loop ;

Here’s the timing function:

: u usecs t usecs swap - . ;

That took 29us.


Although my Forth is immature, and is quite inefficient in how it works, I am very happy about its speed relative to Micropython. So who knows, maybe it can add some value when Micropython is proving just a little too slow to be usable.

Happy programming.

About mcturra2000

Computer programmer living in Scotland.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s