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

Core: Faster Token.stringify #2171

Merged
merged 2 commits into from
Feb 19, 2020

Conversation

RunDevelopment
Copy link
Member

This removes temporary arrays in Token.stringify.

All these changes make Prism.highlight about 23% faster.

Benchmark
Found 6 cases with 13 files in total.
Test 2 candidates on highlight
Estimated duration: 4m 20s

------------------------------------------------------------

css

  ../../style.css (7 kB)
  | local              2.29ms ±  0%  171smp      
  | PrismJS@master     2.60ms ±  0%  174smp 1.13x

------------------------------------------------------------

css!+css-extras (css)

  ../../style.css (7 kB)
  | local              3.42ms ±  0%  164smp      
  | PrismJS@master     3.95ms ±  0%  161smp 1.16x

------------------------------------------------------------

javascript

  ../../components.json (24 kB)
  | local              8.50ms ±  1%  141smp      
  | PrismJS@master     9.23ms ±  0%  148smp 1.09x
  ../../package-lock.json (184 kB)
  | local             68.22ms ± 22%   71smp      
  | PrismJS@master   131.92ms ± 37%   33smp 1.93x
  ../../scripts/utopia.js (11 kB)
  | local              3.77ms ±  1%  159smp      
  | PrismJS@master     4.29ms ±  1%  159smp 1.14x
  prism.js (24 kB)
  | local              7.94ms ±  1%  151smp      
  | PrismJS@master     8.95ms ±  0%  153smp 1.13x
  prism.min.js (13 kB)
  | local              5.96ms ±  1%  161smp      
  | PrismJS@master     6.75ms ±  1%  158smp 1.13x

------------------------------------------------------------

json

  ../../components.json (24 kB)
  | local              7.78ms ±  1%  153smp      
  | PrismJS@master     9.37ms ±  1%  147smp 1.20x
  ../../package-lock.json (184 kB)
  | local             63.43ms ± 10%   76smp      
  | PrismJS@master   149.01ms ± 44%   27smp 2.35x

------------------------------------------------------------

markup

  ../../download.html (4 kB)
  | local              1.18ms ±  0%  179smp      
  | PrismJS@master     1.40ms ±  0%  173smp 1.18x
  ../../index.html (18 kB)
  | local              6.18ms ±  1%  155smp      
  | PrismJS@master     7.14ms ±  1%  149smp 1.16x

------------------------------------------------------------

markup!+css+javascript (markup)

  ../../download.html (4 kB)
  | local              1.88ms ±  1%  168smp      
  | PrismJS@master     2.15ms ±  1%  169smp 1.14x
  ../../index.html (18 kB)
  | local              7.12ms ±  1%  149smp      
  | PrismJS@master     8.13ms ±  1%  147smp 1.14x

------------------------------------------------------------

summary
                  best  worst  avg rel  avg rel norm
  local             13      0    1.00x         1.00x
  PrismJS@master     0     13    1.30x         1.30x

Copy link
Member

@mAAdhaTTah mAAdhaTTah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@RunDevelopment RunDevelopment merged commit f683972 into PrismJS:master Feb 19, 2020
@RunDevelopment RunDevelopment deleted the faster-stringify branch February 19, 2020 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants