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

Pass version as a command line argument to benchmark script #335

Open
lupomontero opened this issue Nov 28, 2024 · 0 comments · May be fixed by #336
Open

Pass version as a command line argument to benchmark script #335

lupomontero opened this issue Nov 28, 2024 · 0 comments · May be fixed by #336
Assignees

Comments

@lupomontero
Copy link
Owner

It could be a good idea to pass the version we want to compare to as a command line argument. That way, by default it would compare the local source code vs the latest published version.

npm run benchmark

Alternatively, you would also be able to compare to a specific published version (ie: v1.13.0):

npm run benchmark -- v1.13.0

To achieve this I think we'd only need to change the following line:

const compareToVersion = 'v1.13.0';

Into this:

const compareToVersion = process.argv[2] || 'latest';

CAVEATS:

  • The benchmarking script only works on ESM (it uses vm.SourceTextModule), so we can only compare to 1.13.0 and above.
  • If a string that is not a valid published version is passed in, the script simply fails ungracefully.

Originally posted by @lupomontero in #334 (comment)

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

Successfully merging a pull request may close this issue.

1 participant