This should allow that if each string sent to Modules.addCached is a native string - but the function declarations themselves will stay in RAM, so it's only the code that ends up in flash. In a module with lots of small functions you may not see any difference at all (in fact it could be worse).
I probably ought to add some code that checks the length of the function. Anything 10 chars or less is better stored in RAM (because the Native String takes up a var anyway).
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
This should allow that if each string sent to Modules.addCached is a native string - but the function declarations themselves will stay in RAM, so it's only the code that ends up in flash. In a module with lots of small functions you may not see any difference at all (in fact it could be worse).
I probably ought to add some code that checks the length of the function. Anything 10 chars or less is better stored in RAM (because the Native String takes up a var anyway).