• @bertyhell

    welcome to the 70'... regarding memory consumption... rather say: non-consumption!

    All the good stuff we learned since then how to build good, robust, extensible, tool supported and all the virtues that come to your mind about software construction ... just aren't good enough anymore when it comes to resourcefulness - in the context of Espruino context / interpreter implementation.

    Minification is a good start, and so is pre-tokenizing, and storing modules as functions, and saving to flash on upload...

    Since Espruino interprets on the source, you may buy some space with some cycles - the old law still applies that nothing is for free - and make 'global'/public names as short as possible... even references to very often used functions that have a nice but not really helpful name when it comes to space.

    I did not use pre-tokenize yet, but I used alternate variable names when it comes even to elements of the JS language... for example I used a lot of Math.min, max, floor, ceil, abs functions... and made them short named properties of the object that uses it. Furthermore, I abandoned nice object orientation and replaced it with indexed arrays where bit encoding was not an option (Have though no real figure for what I saved... but I got it working). Another thing I did - a while ago - I described the pac man maze in a coded way... otherwise, just now way to get it into the space of the Original Espruino... Storing stuff as functions and save to Flash on upload helps a lot to get the code out of the way... but all the other variable things have to fit into the memory.

    Looking forward to see your maze game working!

About

Avatar for allObjects @allObjects started