4 ms·
It used to be. In modern engines it's really no longer the case. Just did a mini test running both attr and class name selectors on 10000 objects. In both insta
by jjcm 6y ago
It used to be. In modern engines it's really no longer the case. Just did a mini test running both attr and class name selectors on 10000 objects. In both instances the paint was fully complete in a single frame.
Agree with the rest of the stuff you've said though. I just don't see a place for this library.
- dubcanada 6y agoI mean you are right, but there are certainly selectors which are "faster" just the faster part is more on the 0.000001ms level than any measurable level. Also I am fairly certain (been a while since I spent time in Webkit source) but class name and attribute selectors are implemented the same, if you want to do a proper benchmark you would want to do id, nested selectors, attributes, class, etc. And at that level you will find a significant difference.
- wilsonrocks 6y agoI could see the point in attribute selectors - when using react I find it messy to programmatically specify class names based on state/props, particularly when using BEM. Setting some Booleans as attributes is much nicer. However, it is built into CSS already, so not sure a library would help...