-
-
Notifications
You must be signed in to change notification settings - Fork 531
update openapi-typescript-fetch bench #1566
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
Conversation
|
@drwpow it's great that lots of progress has been made on a (very elegant) fetch implementation and it is now part of openapi-typescript! 👍 The fetch was completely missing two years back when I first published openapi-typescript-fetch. Just wanted to update the bench with correct usage... |
Thank you for all the inspiration, and pushing it forward as well! To be honest, the benchmarks are a bit flaky (all benchmarks are to some degree, but these even moreso). I’ve been procrastinating fixing the absolute numbers which are pretty unreliable even on the same machine (the relative benchmarks seem accurate, but absolute ops/s fluctuate way more wildly than they should). Either way, thanks for this change. Will update the benchmarks soon with this improved implementation, and hopefully figure out a way to make the runs more consistent. |
Yeah as I said the absolute numbers are kinda garbage from my findings, and I need to replace it with something more reliable. But the relative numbers (e.g. Also as someone that is always learning about benchmarks, you’re benchmarking in V8 (Node, Chrome), which rewards certain particular operations and punishes others. JavaScriptCore (Safari) and SpiderMonkey (Firefox) will have different benchmarks on the same code. But in general, things like RegExs, functional programming ( |
Got it! Time permitting, I'll try to add the following to the benchmark that exercises the following:
In my case I'd to make a clone of the payload because of a design choice (all params are mashed into a single argument and deconstructed) whereas in openapi-fetch this overhead may not be there. Will also publish a esnext version of the library for comparison. |
Changes
Update bench to use openapi-typescript correctly.
Create and reuse the fetch method instead of instantiating it on every invocation.
This should speed up the benchmark slightly.
How to Review
This change moves the method creation outside of the bench
Checklist
docs/
updated (if necessary)pnpm run update:examples
run (only applicable for openapi-typescript)