Skip to content

Commit

Permalink
fix(napi): only delete reference in custom gc
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Dec 29, 2022
1 parent d2a492a commit 877d631
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions crates/napi/src/bindgen_runtime/module_register.rs
Expand Up @@ -598,12 +598,6 @@ extern "C" fn custom_gc(
_context: *mut std::ffi::c_void,
data: *mut std::ffi::c_void,
) {
let mut ref_count = 0;
check_status_or_throw!(
env,
unsafe { sys::napi_reference_unref(env, data as sys::napi_ref, &mut ref_count) },
"Failed to unref Buffer reference in Custom GC"
);
check_status_or_throw!(
env,
unsafe { sys::napi_delete_reference(env, data as sys::napi_ref) },
Expand Down

1 comment on commit 877d631

@github-actions
Copy link

Choose a reason for hiding this comment

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

Benchmark

Benchmark suite Current: 877d631 Previous: ce4c284 Ratio
noop#napi-rs 64257120 ops/sec (±0.24%) 52058761 ops/sec (±0.44%) 0.81
noop#JavaScript 709433789 ops/sec (±0.15%) 608004543 ops/sec (±0.37%) 0.86
Plus number#napi-rs 18576934 ops/sec (±0.14%) 15976158 ops/sec (±0.36%) 0.86
Plus number#JavaScript 708068019 ops/sec (±0.15%) 596705074 ops/sec (±0.3%) 0.84
Create buffer#napi-rs 362638 ops/sec (±9.07%) 347670 ops/sec (±10.01%) 0.96
Create buffer#JavaScript 1992669 ops/sec (±5.36%) 1629493 ops/sec (±4.93%) 0.82
createArray#createArrayJson 39245 ops/sec (±0.13%) 34356 ops/sec (±0.41%) 0.88
createArray#create array for loop 7595 ops/sec (±0.12%) 5909 ops/sec (±0.48%) 0.78
createArray#create array with serde trait 7554 ops/sec (±0.54%) 6614 ops/sec (±0.49%) 0.88
getArrayFromJs#get array from json string 17034 ops/sec (±0.13%) 14645 ops/sec (±0.59%) 0.86
getArrayFromJs#get array from serde 9844 ops/sec (±0.04%) 8670 ops/sec (±0.77%) 0.88
getArrayFromJs#get array with for loop 12567 ops/sec (±0.04%) 10682 ops/sec (±0.45%) 0.85
Get Set property#Get Set from native#u32 413547 ops/sec (±7%) 388920 ops/sec (±6.95%) 0.94
Get Set property#Get Set from JavaScript#u32 350195 ops/sec (±7.03%) 329230 ops/sec (±6.53%) 0.94
Get Set property#Get Set from native#string 372410 ops/sec (±6.45%) 343074 ops/sec (±6.34%) 0.92
Get Set property#Get Set from JavaScript#string 326685 ops/sec (±6.96%) 299073 ops/sec (±6.77%) 0.92
Async task#spawn task 37085 ops/sec (±0.82%) 28609 ops/sec (±1.68%) 0.77
Async task#ThreadSafeFunction 1781 ops/sec (±13.63%) 1116 ops/sec (±13.27%) 0.63
Async task#Tokio future to Promise 33102 ops/sec (±1.13%) 26723 ops/sec (±1.89%) 0.81
Query#query * 100 2136 ops/sec (±1.19%) 1742 ops/sec (±2.28%) 0.82
Query#query * 1 31785 ops/sec (±0.37%) 25460 ops/sec (±2.54%) 0.80

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.