Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Perf comparison #23

Merged
merged 3 commits into from
Feb 18, 2023
Merged

Perf comparison #23

merged 3 commits into from
Feb 18, 2023

Conversation

jasongin
Copy link
Owner

@jasongin jasongin commented Feb 17, 2023

I ported the perf measurement script from edge-js, and took some measurements using release builds. Numbers are microseconds per function call, averaged over 100,000 iterations.

Run # js-baseline edge-js napi-clr napi-aot
1 16.78 92.67 52.9 51.93
2 16.37 95.84 53.34 51.77
3 15.78 87.93 49.67 48.65
4 16.24 95.13 51.97 48.70
5 15.31 95.09 49.51 48.53
average 16.10 93.33 51.48 49.92
Relative performance
edge-js/baseline 579.8%
napi-aot/baseline 310.1%
napi-aot/edge-js 53.5%
napi-clr/napi-aot 97.2%

Interpretation

  • The edge-js/baseline ratio is consistent with the "6x" difference reported in the original Edge project.
  • napi-dotnet is about twice as fast as edge-js, or 3x slower than plain in-engine JS function calls, in this scenario.
  • The napi-dotnet AOT compiled build is consistently about 3% faster than the CLR build. I'd expect a greater difference for a smaller number of iterations, since AOT has the biggest impact on startup time.
  • I'd expect more advanced scenarios to show a larger advantage for napi-dotnet because it supports shared-memory typed-arrays and marshalling classes by reference, whereas edge-js serializes everything.

@jasongin jasongin requested a review from vmoroz February 17, 2023 18:37
Copy link
Collaborator

@vmoroz vmoroz left a comment

Choose a reason for hiding this comment

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

LGTM

@vmoroz
Copy link
Collaborator

vmoroz commented Feb 17, 2023

Wow! These are awesome and promising results!

@jasongin jasongin merged commit 45e01ef into main Feb 18, 2023
@jasongin jasongin deleted the dev/jasongin/perf branch February 18, 2023 00:36
@jasongin
Copy link
Owner Author

Update: #28 cuts this call time by ~15% to around 42 microseconds.

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

Successfully merging this pull request may close these issues.

2 participants