Performance differences between using “:not” and “.not()” selectors?

As you can see from the jsperf test, :not is on average about twice as fast. Overall though this performance will likely be a very small part of your overall execution time.

The jquery docs state:

The .not() method will end up providing you with more readable
selections than pushing complex selectors or variables into a :not()
selector filter. In most cases, it is a better choice.

So really it’s up to you to decide if the fractions of a second you gain outweigh the readability.

Leave a Comment