Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.

M4 Performance
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

M4 Performance

by ptremblett on Thu Oct 08, 2020 5:14 pm

I used CircuitPython to write a simulator for the IBM 1130, a machine I used in the late 1960s. It is over 3500 LOC, so I used the Grand Central because it was the only one with enough RAM. I now have the simulator at the point where it is successfully loading the operating system but it is running three orders of magnitude slower than I had hoped to see. I moved the code to my Mac, ran it, and observed that it ran three orders of magnitude faster than on the Grand Central.

Obviously, I do not expect the M4 to be a match for the chip in my Mac but is this the best I can hope for?

Posts: 10
Joined: Fri Jun 12, 2020 12:03 am

Re: M4 Performance

by dastels on Thu Oct 08, 2020 6:02 pm

Remember that these aren't designed to be anything like what you'd build a desktop system around. They're meant to be embedded in devices. The real foci are I/O and low power consumption. You might be better off making a compromise and using Python3 on a Raspberry Pi.

Now The SAMD51 is probably not far off from the power of an 1130, but you'd be better off writing writing your simulator in C/C++.


Posts: 3767
Joined: Tue Oct 20, 2015 3:22 pm

Re: M4 Performance

by tannewt on Fri Oct 09, 2020 2:02 pm

@ptremblett Can you share the simulator code? There may be optimizations that can be done to make it run faster.

One major source of slowness can be excessive allocations which causes many garbage collections.

You could use `time.monotonic` to measure the speed of different sections and either optimize the worst areas or rewrite them in C with a C module.

Posts: 1837
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.