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

fix: use .call for deoptimization #50

Merged
merged 2 commits into from
Oct 11, 2023
Merged

fix: use .call for deoptimization #50

merged 2 commits into from
Oct 11, 2023

Conversation

Aslemammad
Copy link
Member

Resolves #46

I tried using .call and it worked. but warmup should be used for more accurate results.

Without warmup:

┌─────────┬───────────┬─────────────┬───────────────────┬──────────┬─────────┐
│ (index) │ Task Name │   ops/sec   │ Average Time (ns) │  Margin  │ Samples │
├─────────┼───────────┼─────────────┼───────────────────┼──────────┼─────────┤
│    0    │    'a'    │ '1,668,042' │ 599.505261791414  │ '±0.47%' │ 834022  │
│    1    │    'b'    │  '159,201'  │ 6281.348724802289 │ '±0.36%' │  79601  │
│    2    │    'c'    │  '162,881'  │ 6139.414994407295 │ '±0.09%' │  81441  │
└─────────┴───────────┴─────────────┴───────────────────┴──────────┴─────────┘

With warmup:

┌─────────┬───────────┬───────────┬───────────────────┬──────────┬─────────┐
│ (index) │ Task Name │  ops/sec  │ Average Time (ns) │  Margin  │ Samples │
├─────────┼───────────┼───────────┼───────────────────┼──────────┼─────────┤
│    0    │    'a'    │ '163,825' │ 6104.066796782642 │ '±0.14%' │  81913  │
│    1    │    'b'    │ '164,007' │ 6097.265856596651 │ '±0.09%' │  82004  │
│    2    │    'c'    │ '163,775' │ 6105.922276082101 │ '±0.11%' │  81888  │
└─────────┴───────────┴───────────┴───────────────────┴──────────┴─────────┘

@github-actions
Copy link

github-actions bot commented Jul 23, 2023

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
dist/index.js 2.44 KB (+0.13% 🔺) 49 ms (+0.13% 🔺) 93 ms (-28.62% 🔽) 142 ms
dist/index.cjs 2.69 KB (+0.11% 🔺) 54 ms (+0.11% 🔺) 104 ms (+18.2% 🔺) 158 ms

@Aslemammad Aslemammad merged commit f8d0ada into main Oct 11, 2023
@Aslemammad Aslemammad deleted the fix/deopt-46 branch October 11, 2023 03:15
@kurtextrem
Copy link
Contributor

but warmup should be used for more accurate results

Should the readme reflect this too?

@Aslemammad
Copy link
Member Author

Should the readme reflect this too?

Why not? feel free to open a PR in case you're interested.

kurtextrem added a commit to kurtextrem/tinybench that referenced this pull request Dec 28, 2023
Aslemammad pushed a commit that referenced this pull request Dec 28, 2023
@exequielbc
Copy link

hi 👋🏽 I wanted to learn about what deoptimization is and why it is needed but couldn't find any resources with a web search (there is plenty of resources for optimization though haha).
Could anyone please point me to a resource or explain here? 🙂

@Aslemammad
Copy link
Member Author

Hey @exequielbc! Happy that you're curious, but tbh it's either I don't remember the reason or I just did it randomly and it worked (by benchmarking different solutions)

Sorry for that answer :)

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.

The first run is significantly faster even if .warmup() is used
3 participants