New-Bee ... My biggest Espruino fear is coming true! #3996
Replies: 1 comment
-
Posted at 2014-08-04 by DrAzzy Well - first there's this: http://www.espruino.com/Performance The biggest culprits usually are: Also there's some good news on the horizon, and some good news in the present. Present: The Espruino Board, despite the spec of the chips saying it only has 48k of ram, seems to have 64k (and 512k flash, too). This gets you 2600 jsvars. I autobuild them nightly and they get posted here: http://drazzy.com/espruino/bigram Future: http://forum.espruino.com/conversations/1615/newest/ Posted at 2014-08-04 by @gfwilliams As @drazzy says really - it's really easy to fill up available memory if you use normal arrays. Using stuff like Uint8Array, data goes quite a long way though. Also if you're adding comments, try and add those outside the functions as then they don't get stored in Espruino. Posted at 2014-08-04 by user7114 I removed my GPS user code (to save code space for this testing) and did the following testing below: Summary: @drazzy - fiddling with optimizations produced very mixed results. More work is needed in increasing my user application memory usage ... Comment removal Testing 1 Removed all comments from user application code Error window block: None Optimization Testing 2 Optimations combinations with no text in user code. memory usage before: 884 Error window block ... Errors while minifying - sending unmodified code <------- 3 Optimations combinations with no text in user code. memory usage before: 884 Error window block ... Errors while minifying - sending unmodified code <------- 4 Optimations combinations with no text in user code. memory usage before: 884 Error window block ... Errors while minifying - sending unmodified code <------- 5 Optimations combinations with no text in user code. memory usage before: 884 Error window block ... Errors while minifying - sending unmodified code <------- 6 Optimations combinations with no text in user code. memory usage before: 884 Error window block: None Posted at 2014-08-04 by DrAzzy Unless you're loading your own modules, the IDE will by default use minified versions to begin with ( http://espruino.com/modules - those .min.js files ), so module optimization shouldn't matter. Are there any bizarre bits of syntax in the code you're sending that might be confusing the minifier? I've only seen minification problems when my code has syntax errors (the minifier will choke on them, but sometimes they won't immediately get flagged up by Espruino) I've never had any luck with Advanced Optimizations - it usually produces code that doesn't work (presumably that's why it's 'not recommended') Posted at 2014-08-04 by @gfwilliams 'Module minification' won't be an issue for you - it only applies to modules loaded with The errors will be because the code you're minifying has some problem which means that the minifier can't handle it. I thought it should have told you what the errors were, but you could paste it into http://closure-compiler.appspot.com/home and see what it says. Do you have any large-ish arrays in your code? I would have thought this was actually most likely to be the problem... Posted at 2014-08-04 by @gfwilliams ahh... beaten to it :) Yes, Advanced Optimisations are what's produced by the closure compiler in its 'advanced' mode. Problem is they tend to think that they can rename absolutely everything, which breaks a lot. I think someone could potentially write a configuration for it which explained which things it's not allowed to rename, but I haven't had time to look into it properly. Posted at 2014-08-04 by user7114
Hmmm ... The Espruino won't optimize/minimize if there is an "unknown" error/warning? I took the "LED test delay code snippet" out from the init() startup code. digitalWrite([LED1,LED2,LED3],0b100); From the on-line JS closure compiler warning ... BTW ... going from 1800 jsvars to 3250 jsvars using DrAzzy's bigram provides a much needed breathing room for code development. Thanks DrAzzy Posted at 2014-08-05 by @gfwilliams The minimisation is performed by the closure compiler, Espruino Web IDE just sends the data over to it. The binary literals are ES6 and aren't supported by the minimizer... but when the web ide minimises it usually replaces them for you. I guess it doesn't do it because they are in a string - I'm just surprised that the minimizer picks it up... What errors do you get with bigram? The new ones will include the new changes for memory usage (hence the larger than normal increase in variables). I'm still trying to ensure that the new changes work correctly before I make a 'proper' release - so any feedback you have about what is now not working would be hugely helpful. Posted at 2014-08-05 by @gfwilliams I just tried creating an error in the code in the Web IDE and minifying it - and errors do seem to be reported - like in the image below. I think I've found the problem though - it seems there's a bug in how the Web IDE replaces binary numbers in strings which is causing the minifier to fail without errors. I'll see what I can do to fix it... Attachments: Posted at 2014-08-05 by @gfwilliams Ok, this will be fixed in the next update of the Web IDE that I do (or you can grab the latest from GitHub if you can't wait ). For now, just change your code to:
Posted at 2014-08-06 by user7114
Me too, but using "simple optimizations" on user code, the minimization error blocks flash too quickly and disappear in order. My eyes are not that quick to memorize all the errors. Is there some way to lock or hold the error blocks on screen so I can review the errors? Windows 8.1 64 Bit Posted at 2014-08-06 by @gfwilliams I'm afraid there isn't right now... A new Web IDE should automatically download itself in the next hour or so, and that will at least have the binary number problem solved for you. As a start, I'd suggest that you make sure there are no areas highlighted as possible problems in the Espruino editor itself. Posted at 2014-08-06 by user7114
Workaround ... very fast use the key "prt sc" (print screen) and then take your time and paste the picture into a doc. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-08-04 by user7114
Out of resource memory --> RAM.
I have a GPS, I2C LCD 4x20, two I2C DS3231/2 RTCs and the 1800 memory units will not cut it with my New-Bee javascript user application code.
Is there a checkoff list that provides knowledgeable suggestions on how to reduce memory RAM usage to the bare minimum? Since I don't know the internal workings of the Espruino any help is appreciated.
Beta Was this translation helpful? Give feedback.
All reactions