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

Loading time benchmark is inaccurate #35

Open
alexeyten opened this issue Oct 13, 2021 · 1 comment · May be fixed by #36
Open

Loading time benchmark is inaccurate #35

alexeyten opened this issue Oct 13, 2021 · 1 comment · May be fixed by #36

Comments

@alexeyten
Copy link

Library loading time depends on the order and list of modules that loaded in benchmark/loading-runner.js

If I leave only chalk, kleur/colors, colorette and picocolors then loading times are:

~/picocolors ⬢ v16 ₪ main*= $ node benchmarks/loading
  chalk          7.546 ms
  kleur/colors   2.442 ms
  colorette      2.746 ms
+ picocolors     0.819 ms
~/picocolors ⬢ v16 ₪ main*= $ node benchmarks/loading
  chalk          7.926 ms
  kleur/colors   2.532 ms
  colorette      2.900 ms
+ picocolors     0.867 ms
~/picocolors ⬢ v16 ₪ main*= $ node benchmarks/loading
  chalk          7.351 ms
  kleur/colors   2.344 ms
  colorette      2.743 ms
+ picocolors     0.811 ms

but simply adding nanocolors shaves off 0.1 ms:

~/picocolors ⬢ v16 ₪ main*= $ node benchmarks/loading
  chalk          7.178 ms
  kleur/colors   2.304 ms
  colorette      2.694 ms
  nanocolors     1.200 ms
+ picocolors     0.720 ms
~/picocolors ⬢ v16 ₪ main*= $ node benchmarks/loading
  chalk          7.174 ms
  kleur/colors   2.337 ms
  colorette      2.715 ms
  nanocolors     1.227 ms
+ picocolors     0.711 ms
~/picocolors ⬢ v16 ₪ main*= $ node benchmarks/loading
  chalk          6.862 ms
  kleur/colors   2.183 ms
  colorette      2.563 ms
  nanocolors     1.136 ms
+ picocolors     0.685 ms

and putting picocolors right after kleur/colors will double loading time (also see that colorette time drops)

~/picocolors ⬢ v16 ₪ main*= $ node benchmarks/loading
  chalk          6.831 ms
  kleur/colors   2.195 ms
+ picocolors     1.499 ms
  colorette      1.767 ms
  nanocolors     1.023 ms
~/picocolors ⬢ v16 ₪ main*= $ node benchmarks/loading
  chalk          6.688 ms
  kleur/colors   2.133 ms
+ picocolors     1.486 ms
  colorette      1.702 ms
  nanocolors     1.027 ms
~/picocolors ⬢ v16 ₪ main*= $ node benchmarks/loading
  chalk          6.720 ms
  kleur/colors   2.185 ms
+ picocolors     1.511 ms
  colorette      1.767 ms
  nanocolors     1.027 ms
@alexeyraspopov alexeyraspopov linked a pull request Oct 13, 2021 that will close this issue
@alexeyraspopov
Copy link
Owner

Thanks for testing it out and reporting the issue! I've opened #36 to possibly make this benchmark more reliable.

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 a pull request may close this issue.

2 participants