Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

my guess is the first thing the selector does is query by class, and then filters from that set. likely not as intensive as you think.


yes, I'm guessing it filters by class first as well. but it would be interesting to find out if just updating all the timestamps would be as fast (or faster) than doing the secondary regex filter anyway? i'm not sure, i haven't run any benchmarks on it.


Or, another alternative, add a secondary class so that the overall markup is class="_timestamp _timestamp_group0", etc. Perhaps they tested this and found it to be a negligible improvement, but then you're only selecting on the one class, rather than selecting on class and filtering.


http://jsperf.com/jquery-attribute-selector-performance

Looks like the class only helps slightly. It's definitely doing some optimization though.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: