Hey folks!
While thinking about how I could better optimize my code than just with my
coding style, and tools, I came across the SMAZ algo, and that got me thinking.
Because there is a module named keysquash that picks up commonly used keynames
in a code, and wraps it in a function, to reduce the amount of code when being
compressed. I wonder if this is possible for strings, too.
Commonly, a script may contain a lot of event names, such as "error", "data" or
in a browser: "click". So would it theoretically be possible to save bytes, by
replacing them?
For instance, if we had (I know, really small. Try to imagine a bigger chunk):
SomeElementNames.forEach((name)=>{
document.getElementById(name).addEventListener("click",
function(){})
})
Would replacing it into something like
((x)=>{
SomeElementNames.forEach((name)=>{
document.getElementById(name).addEventListener(x.a,
function(){})
})
})({a:"click"})
actually help?
I was thinking of what would happen if we also added SMAZ here and a simple
decompressor. But that may depend on the sceneā¦
What do you guys think?
Kind regards,
Ingwie
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/DE3FD791-69BC-4AFA-BA38-C85DA1F80CFA%40googlemail.com.
For more options, visit https://groups.google.com/d/optout.