-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setCliChanged simplified logic adds redundant string compares #91
Comments
@dlemstra for vis. |
That's a great point and thanks for reviewing my changes. Next time feel free to directly open a PR that addresses this. I can also make the changes myself if you would prefer me to do that. |
That'll be easier for me this time if you could make the change. :) I'm in a bit of a hybrid workstation setup right now, so a lot of this is being done from mobile. 🤢 But in the future I can just do PRs. 👍 |
It seems that the minifier that I am using (https://minify-js.com/) moves the compare inside the for loop so I will keep it like this. |
@dlemstra are you sure? I copied that segment into that minifier's website and it did not move the compare inside the forloop. input:
output: (formatted version of minified code):
|
Yeah you are right... weird. I probably went to the output tab without re-compressing again... |
Hi! Thanks for pulling #89. I reviewed the changes since then. They all look pretty good. The only one I wanted to bring up as a potential issue is 29aecdd which moves the string comparison
language == "Windows"
etc inside the for loop. Although this looks simpler and cleaner, it does mean that the string compare is done each time instead of done once at the start and moved each other time.I'm not familiar with the internals of the javascript interpreter, but I'd be shocked to learn that this is a more efficient algorithm. I guess there is a chance that the extra bytes for the few extra lines outweigh the algorithm costs in download, but that feels more dependent on internet speeds etc.
I think these string compares and conditionals pulled back out of the loop for algorithm simplicity, preventing redundant operations in the loops.
The text was updated successfully, but these errors were encountered: