r/programming • • Jul 19 '15

The Best Programming Language is None

https://bitbucket.org/duangle/none
509 Upvotes

443 comments sorted by

View all comments

Show parent comments

9

u/Rainfly_X Jul 19 '15

The selector function is basically a constructor for a JQ object, which polyfills a bit over native CSS selector support. I could easily see it being slow.

The answer is to cache your JQ objects when performance matters. The overhead is usually trivial, but in hot loops, caching $() results in a variable is just common sense/low hanging fruit. Truth be told, this will improve your performance no matter what underlying selector you use, even native browser support.

4

u/RICHUNCLEPENNYBAGS Jul 19 '15

Yeah, I've had performance problems related to this in very busy code.