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(core): op_baseline bench #9924

Merged
merged 1 commit into from
Mar 30, 2021
Merged

Conversation

AaronO
Copy link
Contributor

@AaronO AaronO commented Mar 28, 2021

This PR introduces a benchmark that serves to measure the baseline-overhead of ops (or the per-category upper bound).

This should also serve to:

Output

~/git/deno/core bench/op-baseline
❯ cargo bench

...

running 3 tests
test bench_op_nop     ... bench:     603,784 ns/iter (+/- 102,433)
test bench_op_pi_bin  ... bench:     873,331 ns/iter (+/- 39,010)
test bench_op_pi_json ... bench:   3,210,314 ns/iter (+/- 290,248)

test result: ok. 0 passed; 0 failed; 0 ignored; 3 measured

Notes

  • Each bench iter has 1000 JS loop-iterations, so divide by 1000 to have the true ns/op

@AaronO AaronO changed the title perf(core): add op_baseline bench perf(core): op_baseline bench Mar 28, 2021
@AaronO
Copy link
Contributor Author

AaronO commented Mar 29, 2021

Here are the results of this bench on #9843:

test bench_op_nop     ... bench:     536,430 ns/iter (+/- 137,708)
test bench_op_pi_bin  ... bench:     779,053 ns/iter (+/- 30,542)
test bench_op_pi_json ... bench:     675,587 ns/iter (+/- 23,755)

@ry
Copy link
Member

ry commented Mar 29, 2021

Looks good.

Will bin ops exist after #9843?

@AaronO
Copy link
Contributor Author

AaronO commented Mar 29, 2021

@ry They'll still exist immediately after #9843, since I wanted to limit code changes outside of core/.

It would now be trivial to collapse all our ops and have only core.opAsync, core.opSync. But I think it may be worth keeping them around as abstractions, not as implementations, as mentioned in #9843's Key Ideas:

Preserve concepts of json/bin/min as semantic groups of their inputs/outputs instead of their op-encoding strategy, preserving these groups will also facilitate partial transitions over to v8 Fast API for the "min" and "bin" groups

Talking with @bartlomieju, he seemed eager to collapse the extra abstractions. But I think our diverging views may stem from the fact that he associates bin-ops with the implementation and its technical debt, but given that I'm fairly new to deno it's easier to dissociate the abstraction/semantic-group from the implementation.

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

LGTM

@bartlomieju bartlomieju merged commit 7efea6c into denoland:main Mar 30, 2021
@AaronO AaronO deleted the bench/op-baseline branch March 30, 2021 14:21
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

3 participants