Closed marcobiedermann closed 8 years ago
Hello there, thank you for contributing!
You realize there are three (3) uses of document
in the code and that it's a 1KB script, right? What minification?! What performance improvement?!
I respect your effort and hate closing PRs without merging, but I think this is textbook premature optimization. I hope this does not discourage you from future contributions.
@LeaVerou
You are absolutely right in every point. Still I think that caching the document is an improvement. A really small one but it is :) I like to improve code, even if it is just a tiny bit. Lot's of tiny things make up a big one.
But I absolutely understand your point. That is totally fine :)
Thanks for this project and all your other great stuff 👍
Still I think that caching the document is an improvement. A really small one but it is :)
For the sake of argument, I disagree. Everything comes at a cost. If document
was used in tons of places, in loops etc, the cost would be worth it, but the cost is always there. For example, the cost of this is:
Sure, it's a small cost, but it's also a small benefit, and I wouldn't be so sure which one outweighs the other.
@LeaVerou Alright fair enough! :)
Caching the
document
locally will improve the performance and helps when minification is used.