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

perf: add benchmarks for importing all packages #24

Merged
merged 1 commit into from Oct 10, 2022
Merged

Conversation

anonrig
Copy link
Owner

@anonrig anonrig commented Oct 3, 2022

Related to nodejs/undici#1679

➜  fast-querystring git:(perf/benchmark) npm run benchmark:import

> fast-querystring@1.0.0 benchmark:import
> node benchmark/import.mjs

╔═════════════════════════════╤═════════╤══════════════════╤═══════════╗
║ Slower tests                │ Samples │           Result │ Tolerance ║
╟─────────────────────────────┼─────────┼──────────────────┼───────────╢
║ @aws-sdk/querystring-parser │    1000 │  10219.42 op/sec │  ± 0.47 % ║
║ querystringparser           │    1000 │  10733.12 op/sec │  ± 0.47 % ║
║ query-string                │    1000 │  11056.24 op/sec │  ± 0.47 % ║
║ qs                          │    1000 │  11117.31 op/sec │  ± 0.49 % ║
║ querystringify              │    1000 │  11737.47 op/sec │  ± 0.49 % ║
║ fast-querystring            │    1500 │  37799.39 op/sec │  ± 0.86 % ║
╟─────────────────────────────┼─────────┼──────────────────┼───────────╢
║ Fastest test                │ Samples │           Result │ Tolerance ║
╟─────────────────────────────┼─────────┼──────────────────┼───────────╢
║ node:querystring            │   10000 │ 228785.04 op/sec │  ± 1.19 % ║
╚═════════════════════════════╧═════════╧══════════════════╧═══════════╝

@anonrig anonrig requested a review from mcollina October 3, 2022 15:57
@climba03003
Copy link

climba03003 commented Oct 11, 2022

Pretty unfair to compare from relative path and module name.
It give a false result to indicate this module is significant faster than others.

> fast-querystring@1.0.0 benchmark:import
> node benchmark/import.mjs

╔═════════════════════════════╤═════════╤══════════════════╤═══════════╗
║ Slower tests                │ Samples │           Result │ Tolerance ║
╟─────────────────────────────┼─────────┼──────────────────┼───────────╢
║ @aws-sdk/querystring-parser │    1000 │   1847.15 op/sec │  ± 0.46 % ║
║ querystringparser           │    1000 │   2005.94 op/sec │  ± 0.57 % ║
║ qs                          │    1000 │   2089.31 op/sec │  ± 0.29 % ║
║ fast-querystring            │    1000 │   2104.44 op/sec │  ± 0.28 % ║
║ querystringify              │    1000 │   2302.10 op/sec │  ± 0.58 % ║
║ query-string                │    1000 │   2302.31 op/sec │  ± 0.27 % ║
╟─────────────────────────────┼─────────┼──────────────────┼───────────╢
║ Fastest test                │ Samples │           Result │ Tolerance ║
╟─────────────────────────────┼─────────┼──────────────────┼───────────╢
║ node:querystring            │   10000 │ 118867.90 op/sec │  ± 1.15 % ║
╚═════════════════════════════╧═════════╧══════════════════╧═══════════╝

@anonrig
Copy link
Owner Author

anonrig commented Oct 11, 2022

@climba03003 This is already a pretty unfair comparison since node:querystring loads faster due to node internals. Can you open a pull request to update your changes?

@climba03003
Copy link

climba03003 commented Oct 11, 2022

@climba03003 This is already a pretty unfair comparison since node:querystring loads faster due to node internals. Can you open a pull request to update your changes?

Yes, for comparing internal is unfair to others. At least, it could be fair the packages in node_modules.
I cannot find a good way to install the package itself without listing in dependency.
Would it be fine in listing itself in the devDependency?

@anonrig
Copy link
Owner Author

anonrig commented Oct 11, 2022

I don't think it should list itself as a dev dependency. Let's just replace file path with fast-querystring. We will push the responsability to the developer to install the dependency while running the benchmark.

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