Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reduce calls to Node.prototype.toString() #1848

Conversation

romainmenke
Copy link
Contributor

see : #1847

@romainmenke romainmenke changed the title reduce calls to Node.prototype.toString() reduce calls to Node.prototype.toString() Jul 2, 2023
lib/node.js Show resolved Hide resolved
@ai
Copy link
Member

ai commented Jul 2, 2023

What are https://github.com/postcss/benchmark changes?

@romainmenke
Copy link
Contributor Author

romainmenke commented Jul 2, 2023

Apparently there is something not happy on M1/M2.
Everything is consistently faster on my machine than on an older Intel, but these benchmarks run a lot slower than expected.
So the exact times are way of, but the delta seems to a good indication.

Running suite Preprocessors 
   LibSass x 1.62 ops/sec ±0.85% (13 runs sampled)
   LibSass sync x 1.63 ops/sec ±1.12% (9 runs sampled)
   Dart Sass x 0.53 ops/sec ±6.31% (7 runs sampled)
   Dart Sass sync x 0.83 ops/sec ±3.14% (7 runs sampled)
   PostCSS x 2.50 ops/sec ±4.95% (17 runs sampled)
   PostCSS sync x 2.39 ops/sec ±3.67% (16 runs sampled)
   Next PostCSS x 2.43 ops/sec ±10.33% (16 runs sampled)
   Less x 1.21 ops/sec ±5.01% (11 runs sampled)
   Next PostCSS sync x 2.21 ops/sec ±5.47% (15 runs sampled)
Fastest tests are PostCSS,Next PostCSS at 1.03x faster than Next PostCSS

PostCSS:           400 ms
Next PostCSS:      412 ms  (1.0 times slower)
PostCSS sync:      418 ms  (1.0 times slower)
Next PostCSS sync: 453 ms  (1.1 times slower)
LibSass sync:      615 ms  (1.5 times slower)
LibSass:           615 ms  (1.5 times slower)
Less:              824 ms  (2.1 times slower)
Dart Sass sync:    1207 ms (3.0 times slower)
Dart Sass:         1900 ms (4.7 times slower)


Running suite Parsers
   Rework x 2.64 ops/sec ±7.73% (11 runs sampled)
   Next PostCSS x 3.67 ops/sec ±6.53% (22 runs sampled)
   PostCSS x 3.40 ops/sec ±7.82% (21 runs sampled)
   PostCSS Full x 1.30 ops/sec ±12.56% (10 runs sampled)
   CSSOM x 0.38 ops/sec ±0.87% (5 runs sampled)
   Mensch x 0.06 ops/sec ±6.67% (5 runs sampled)
   Gonzales x 0.23 ops/sec ±15.73% (5 runs sampled)
   CSSTree x 3.54 ops/sec ±9.83% (14 runs sampled)
   ParserLib x 0.83 ops/sec ±5.68% (7 runs sampled)
   Stylecow x 1.81 ops/sec ±3.01% (9 runs sampled)
   Stylis x 7.75 ops/sec ±16.33% (26 runs sampled)
Fastest test is Stylis at 2.2x faster than CSSTree and Next PostCSS

Stylis:       129 ms   (2.3 times faster)
Next PostCSS: 272 ms   (1.1 times faster)
CSSTree:      282 ms   (1.0 times faster)
PostCSS:      294 ms
Rework:       380 ms   (1.3 times slower)
Stylecow:     553 ms   (1.9 times slower)
PostCSS Full: 772 ms   (2.6 times slower)
ParserLib:    1207 ms  (4.1 times slower)
CSSOM:        2658 ms  (9.0 times slower)
Gonzales:     4269 ms  (14.5 times slower)
Mensch:       15479 ms (52.6 times slower)


Running suite Prefixers 
   Autoprefixer dev x 1.17 ops/sec ±9.44% (11 runs sampled)
   Stylis x 6.71 ops/sec ±13.86% (22 runs sampled)
   Autoprefixer x 1.21 ops/sec ±6.53% (11 runs sampled)
   Stylecow x 0.02 ops/sec ±2.47% (5 runs sampled)
Fastest test is Stylis at 5.7x faster than Autoprefixer dev and Autoprefixer

Stylis:           149 ms   (5.6 times faster)
Autoprefixer:     829 ms
Autoprefixer dev: 857 ms   (1.0 times slower)
Stylecow:         66070 ms (79.7 times slower)


Running suite Tokenizers
   PostCSS x 15.37 ops/sec ±11.82% (77 runs sampled)
   Next PostCSS x 15.25 ops/sec ±13.91% (75 runs sampled)
Fastest tests are PostCSS,Next PostCSS

PostCSS:      65 ms
Next PostCSS: 66 ms (1.0 times slower)


Running suite Linters
   PostCSS x 0.16 ops/sec ±5.04% (5 runs sampled)
   Next PostCSS x 0.17 ops/sec ±9.38% (5 runs sampled)
Fastest tests are Next PostCSS,PostCSS

Next PostCSS: 5980 ms (1.1 times faster)
PostCSS:      6332 ms

A run with only the linters test after letting my machine cool a bit :

   PostCSS x 0.20 ops/sec ±2.80% (5 runs sampled)
   Next PostCSS x 0.22 ops/sec ±1.34% (6 runs sampled)
Fastest test is Next PostCSS at 1.10x faster than PostCSS

Next PostCSS: 4649 ms (1.1 times faster)
PostCSS:      5099 ms

@ai ai merged commit 87e6dc8 into postcss:main Jul 6, 2023
7 checks passed
@romainmenke romainmenke deleted the reduce-calls-to-node-toString--ambitious-scorpion-82d381af30 branch July 6, 2023 11:26
@ai
Copy link
Member

ai commented Jul 6, 2023

Thanks. Released at 8.4.25.

@romainmenke
Copy link
Contributor Author

Thank you @ai 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants