Skip to content

perf: reduce the overhead of binding function call#139

Merged
toyobayashi merged 4 commits intomainfrom
function-call-overhead
Mar 28, 2025
Merged

perf: reduce the overhead of binding function call#139
toyobayashi merged 4 commits intomainfrom
function-call-overhead

Conversation

@toyobayashi
Copy link
Copy Markdown
Owner

@toyobayashi toyobayashi commented Mar 26, 2025

About 1.5x faster in average

macOS 14.4.1 23E224 arm64 Apple M2 Pro 32GB

Node.js v22.13.1

Before

binding: function () {}
                 emnapi #emptyFunction x 40,783,722 ops/sec ±0.83% (98 runs sampled)

binding: function (obj) { return obj }
                 emnapi #returnParam x 21,951,118 ops/sec ±0.54% (94 runs sampled)

After

binding: function () {}
                 emnapi #emptyFunction x 63,958,599 ops/sec ±1.10% (94 runs sampled)

binding: function (obj) { return obj }
                 emnapi #returnParam x 29,147,277 ops/sec ±0.65% (93 runs sampled)

@toyobayashi toyobayashi merged commit 1cea7f2 into main Mar 28, 2025
7 checks passed
@toyobayashi toyobayashi deleted the function-call-overhead branch March 28, 2025 10:28
toyobayashi added a commit that referenced this pull request Mar 28, 2025
* perf: reduce the overhead of binding function call

* cache callback info object in scope

* reduce closure variables captured in binding function that results 1.4x fast

* MIN_CHROME_VERSION 85
toyobayashi added a commit that referenced this pull request Mar 28, 2025
* perf: reduce the overhead of binding function call

* cache callback info object in scope

* reduce closure variables captured in binding function that results 1.4x fast

* MIN_CHROME_VERSION 85
toyobayashi added a commit that referenced this pull request Mar 28, 2025
* perf: reduce the overhead of binding function call

* cache callback info object in scope

* reduce closure variables captured in binding function that results 1.4x fast

* MIN_CHROME_VERSION 85
toyobayashi added a commit that referenced this pull request Mar 28, 2025
* perf: reduce the overhead of binding function call

* cache callback info object in scope

* reduce closure variables captured in binding function that results 1.4x fast

* MIN_CHROME_VERSION 85
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.

1 participant