App loader and minifying

Posted on
  • Hi,

    I am using rather long variable names and a lot of long comments in my code. This is to make it as readable as possible.
    Downside: The code gets very big and I run into memory problems too early.

    When uploading the code, I am using minifying to reduce the size.

    Two questions:

    1. I experienced problems with the settings.js file when using minification. My guess is that is because variable names are not consistent anymore between files. Could that be?
    2. Does the app loader do some minification? I do not want to upload code without comments, but they really do not have to be on the watch. I do not think it does, because the comments are in the files on the watch. Can minifaction be enabled by some switch?

    Thanks
    Christian

    Thanks

  • As much as your coding practice is laudable,... it is challenging the memory constraint, since it is not compiling to byte or token code and interpret it but it does it all from source. Simple minification helps to get rid of the comments and the long variable names that have function / block scope. Other than that it cannot handle more compression (short names) without more meta information. Globals - variables and functions have to be the same if you minify multiple files individually. Building protytpes(/classes) and as short as possible functions(methods) and - if data and process separated - have data-objects with short as possible property names helps with space. Comment is never and issue. What helps as well is putting the code into a modules and used these minified.

  • There's actually an issue open to add some very basic minification here: https://github.com/espruino/BangleApps/i­ssues/3

    Issue #3 so it's been going for a while. It's very high up my list so it should be done soon, but right now I spend a good 80% of my time answering emails so I'm not getting much time to enable it :(

    I experienced problems with the settings.js file when using minification. My guess is that is because variable names are not consistent anymore between files. Could that be?

    I don't think that should be it - not unless you used some really serious minification. Usually it only touches variable names when it's 100% sure they can be changed

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

App loader and minifying

Posted by Avatar for Purple-Tentacle @Purple-Tentacle

Actions