Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Unify filtering by selector in `winnow` #3272
Comments
|
Poor man's jsPerf benchmark: https://jsfiddle.net/uo2j7syk/ # {method}_{selector complexity}_{implementation}
find_simple_master: 1,125 ±2% (1,105–1,145) ops/sec
find_simple_direct: 1,140 ±2% (1,122–1,157) ops/sec
find_simple_intersect: 190 ±2% (186–193) ops/sec
not_simple_master: 524 ±2% (515–532) ops/sec
not_simple_direct: 529 ±2% (521–537) ops/sec
not_simple_intersect: 180 ±2% (177–183) ops/sec
find_complex_master: 483 ±2% (476–491) ops/sec
find_complex_direct: 743 ±1% (732–754) ops/sec
find_complex_intersect: 477 ±2% (470–485) ops/sec
not_complex_master: 440 ±2% (433–447) ops/sec
not_complex_direct: 393 ±2% (386–399) ops/sec
not_complex_intersect: 441 ±2% (433–449) ops/secThe current code is taking a huge performance hit vs. always using only |
|
Nice benchmark! I still like the idea of simplifying the code as well. |
|
+1 for simplifying |
For both simple and complex selectors, use direct filter in winnow Closes jquerygh-3272
For both simple and complex selectors, use direct filter in winnow Closes jquerygh-3272
Per https://github.com/jquery/jquery/pull/3261/files/c1339665c27440a23a5576ca1dfdad9c38567288#r74370245 , the complexity of separate branches for simple vs. non-simple selectors doesn't seem worthwhile. Both of them should defer directly to
jQuery.filter.