5/29/2023 0 Comments Javascript mousex![]() You'd still work on the regular, readable code, and then let the minifier compress it into highly compact but humanly-unreadable gibberish.įor an example, go to and view source - a lot of that nonsense is heavily optimized and minified javascript. Those few lines above probably take less time to transmit than it takes to even establish the connection they're sent through.īut even if you have a ton of code, you'd use a minifier to make your JavaScript more compact after you've written it. ![]() ![]() But even that's only really interesting if you have thousands of lines of code. Sidenote: Since JavaScript is almost always part of a web page, and thus sent over the internet, it is actually worth making it short, since it'll take less space, and thus download faster. Short code, in and of itself, doesn't automatically impact these. Maybe it's memory usage, maybe it's speed, maybe it's safety, or extensibility. Point is, you have to know what metric you're interested in. But it can also be inefficient and short. the code takes an overly complicated route to accomplish its task). Sure, code can be inefficient and long - typically, that's how it works out (e.g. Efficient code is a goal, but code length and efficiency are not the same thing. But that's just a minor shortcut built into Processing.īut really, why shorten it? Short code is not a goal in itself*. Well, I guess you can reduce background(255, 255, 255) to background(255) since Processing will automatically assume you mean that 255 should be used for all three. Almost line for line (just backwards, kinda). Processing.js is already doing the heavy-lifting of setting up a canvas so you can draw, hooking up to the DOM, etc. There's basically nothing to shorten here.
0 Comments
Leave a Reply. |