-
• #2
I think it's a bit too complex for that...
As a rule of thumb, expect to be able to store 12 characters for each 'JsVar' reported by
process.memory
, so if you have 5000 variables then that's 60,000 characters.But in order to actually load a module, you have to be able to send it as a string, unescape that string, and then convert that to real functions in memory - so realistically each module needs 3 times that to load - even if once loaded it'll only use about the original amount of memory.
... so actually you could load more into Espruino if you had a few smaller modules than if you had one large one.
Hope that helps!
Is there an estimated file size limit of all modules loaded into memory or a maximum amount of modules that will be interpreted in any single application? Considering that each variable takes a certain amount of memory, certain modules may do more computation that actually defining variables/functions to consume that memory and can be garbage collected clearing the memory. In other words, is there a way to calculate the lowest required memory overhead to just load and interpret a module, granted that module is minimized and minified as much as possible and all other performance best practices have been utilized?