Open lvml opened 1 year ago
This is a good point, actually - I too remember looking at similar books for BASIC and being amazed at the speed difference when dropping to a lower level language.
If you're able, would you be up for writing an article using these examples over at https://github.com/lancaster-university/codal-documentation ? I'd suggest as a project for now, so under this path: https://github.com/lancaster-university/codal-documentation/tree/master/docs/projects
Happy to accept any PRs for this kind of example/article over there :)
If you're able, would you be up for writing an article using these examples over at https://github.com/lancaster-university/codal-documentation ? I'd suggest as a project for now, so under this path: https://github.com/lancaster-university/codal-documentation/tree/master/docs/projects
Happy to accept any PRs for this kind of example/article over there :)
Ok, find my PR here: https://github.com/lancaster-university/codal-documentation/pull/5
Looking at the web-pages of both microbit.org and on the Codal documentation/samples for the Micro:Bit v2 boards, I noticed that software performance was not advertised as a great benefit over using script-languages like MicroPython on these tiny boards.
I remember, when I was a child, a few lines of BASIC compared with a few lines of 6502-Assembler, run on a Commodore C64 to just cycle through screen colors, was all it took to immediately convince me that learning "machine language" was worth the effort.
It would really be a missed opportunity to not mention the speed differences between different programming languages, as it is easy to provide an impressive little example: Here is a little program that just increments a counter variable, and every 4096 counts, the more significant bits of the counter are displayed as one bit per pixel. The user can also press the A-button to pause the increments or press B to continue. Find below a version in MicroPython and one in C++ - the difference is easily visible with the naked eye, the C++ version runs about 100 to 200 times faster than the MicroPython version! Children should know about this.
Feel free to use these code snippets as examples in your microbit-v2-samples repository, if you like. There may be more sophisticated ideas to demonstrate "what better performance can do for you", but I wanted to keep the code examples so simple that the similarity of the code is easy to spot.
MicroPython version:
C++ version: