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(utils): add benchmark logic and example #137

Merged
merged 18 commits into from
Oct 25, 2023
Merged

perf(utils): add benchmark logic and example #137

merged 18 commits into from
Oct 25, 2023

Conversation

BioPhoton
Copy link
Collaborator

@BioPhoton BioPhoton commented Oct 22, 2023

This PR includes a test setup for micro benchmarking.

Example output:

> nx run utils:perf

You can adjust the number of runs with the following arguments:
numAudits1      Number of audits in plugin 1.       --numAudits1=27
numAudits2      Number of audits in plugin 2.       --numAudits2=18
numGroupRefs2   Number of groups refs in plugin 2.  --numGroupRefs2=9
 
Start benchmark...
 
scoreReport x 64,436 ops/sec ±11.96% (31 runs sampled)
scoreReportOptimized0 x 68,970 ops/sec ±13.30% (32 runs sampled)
scoreReportOptimized1 x 110,841 ops/sec ±15.09% (33 runs sampled)
scoreReportOptimized2 x 112,509 ops/sec ±14.59% (30 runs sampled)
 
Fastest is scoreReportOptimized2,scoreReportOptimized1
Total Duration:  23.25 sec

@vmasek and @matejchalk lets define a standard here

More information

npx node ./packages/utils/perf/index.mjs

You can adjust the number of runs with the following arguments:
numAudits1      Number of audits in plugin 1.       --numAudits1=27
numAudits2      Number of audits in plugin 2.       --numAudits2=18
numGroupRefs2   Number of groups refs in plugin 2.  --numGroupRefs2=9
 
Start benchmark...
 
scoreReport x 322,009 ops/sec ±0.39% (96 runs sampled)
scoreReportOptimized0 x 320,646 ops/sec ±0.41% (98 runs sampled)
scoreReportOptimized1 x 544,296 ops/sec ±0.47% (97 runs sampled)
scoreReportOptimized2 x 543,131 ops/sec ±0.44% (97 runs sampled)
 
Fastest is scoreReportOptimized1,scoreReportOptimized2
Total Duration:  21.72 sec

---

npx bun ./packages/utils/perf/index.mjs

You can adjust the number of runs with the following arguments:
numAudits1      Number of audits in plugin 1.       --numAudits1=27
numAudits2      Number of audits in plugin 2.       --numAudits2=18
numGroupRefs2   Number of groups refs in plugin 2.  --numGroupRefs2=9
 
Start benchmark...
 
scoreReport x 976,161 ops/sec ±0.59% (96 runs sampled)
scoreReportOptimized0 x 919,979 ops/sec ±0.36% (96 runs sampled)
scoreReportOptimized1 x 1,019,608 ops/sec ±0.35% (98 runs sampled)
scoreReportOptimized2 x 1,003,331 ops/sec ±0.42% (97 runs sampled)
 
Fastest is scoreReportOptimized1
Total Duration:  21.64 sec

@BioPhoton BioPhoton added the 🔥 performance performance optimization label Oct 22, 2023
Copy link
Collaborator

@matejchalk matejchalk left a comment

Choose a reason for hiding this comment

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

Nice, I like that it's separated in it's own perf folder 👍

README.md Outdated Show resolved Hide resolved
packages/utils/.eslintrc.json Outdated Show resolved Hide resolved
packages/utils/project.json Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
nx.json Outdated Show resolved Hide resolved
BioPhoton and others added 2 commits October 25, 2023 16:57
Co-authored-by: Matěj Chalk <34691111+matejchalk@users.noreply.github.com>
@BioPhoton BioPhoton merged commit 142943e into main Oct 25, 2023
6 checks passed
@BioPhoton BioPhoton deleted the add-perf-tests branch October 25, 2023 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔥 performance performance optimization
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants