-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli,napi-derive): re-export types from shared crate
- Loading branch information
1 parent
3b831f4
commit cb42c92
Showing
13 changed files
with
101 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[package] | ||
authors = ["LongYinan <lynweklm@gmail.com>"] | ||
edition = "2021" | ||
name = "napi-shared" | ||
publish = false | ||
version = "0.1.0" | ||
|
||
[dependencies] | ||
napi = { path = "../../crates/napi", default-features = false, features = [ | ||
"tokio_fs", | ||
"napi8", | ||
"tokio_rt", | ||
"serde-json", | ||
"async", | ||
"experimental", | ||
"latin1", | ||
"chrono_date", | ||
] } | ||
napi-derive = { path = "../../crates/macro", features = ["type-def"] } | ||
|
||
[build-dependencies] | ||
napi-build = { path = "../../crates/build" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
use napi_derive::napi; | ||
|
||
#[napi(object)] | ||
pub struct Shared { | ||
pub value: u32, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,7 @@ mod object; | |
mod promise; | ||
mod reference; | ||
mod serde; | ||
mod shared; | ||
mod string; | ||
mod symbol; | ||
mod task; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use napi_derive::napi; | ||
use napi_shared::Shared; | ||
|
||
#[napi] | ||
pub fn return_from_shared_crate() -> Shared { | ||
Shared { value: 42 } | ||
} |
cb42c92
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
noop#napi-rs
61204230
ops/sec (±0.32%
)49256299
ops/sec (±1.23%
)0.80
noop#JavaScript
711270385
ops/sec (±0.13%
)729666474
ops/sec (±0.95%
)1.03
Plus number#napi-rs
18113274
ops/sec (±0.67%
)14677733
ops/sec (±0.96%
)0.81
Plus number#JavaScript
709401842
ops/sec (±0.15%
)696004559
ops/sec (±1.06%
)0.98
Create buffer#napi-rs
411222
ops/sec (±8.47%
)316631
ops/sec (±9.79%
)0.77
Create buffer#JavaScript
2054064
ops/sec (±8.13%
)1472552
ops/sec (±6.88%
)0.72
createArray#createArrayJson
40306
ops/sec (±0.08%
)32700
ops/sec (±0.99%
)0.81
createArray#create array for loop
7559
ops/sec (±0.1%
)6001
ops/sec (±0.88%
)0.79
createArray#create array with serde trait
7533
ops/sec (±0.1%
)6151
ops/sec (±0.77%
)0.82
getArrayFromJs#get array from json string
16854
ops/sec (±0.12%
)14300
ops/sec (±0.95%
)0.85
getArrayFromJs#get array from serde
10294
ops/sec (±0.04%
)8369
ops/sec (±1.05%
)0.81
getArrayFromJs#get array with for loop
12421
ops/sec (±0.22%
)10193
ops/sec (±1.25%
)0.82
Get Set property#Get Set from native#u32
441502
ops/sec (±8.3%
)387711
ops/sec (±8.4%
)0.88
Get Set property#Get Set from JavaScript#u32
384378
ops/sec (±10.03%
)341191
ops/sec (±9.69%
)0.89
Get Set property#Get Set from native#string
416108
ops/sec (±15.14%
)371833
ops/sec (±4.07%
)0.89
Get Set property#Get Set from JavaScript#string
382478
ops/sec (±3.37%
)310627
ops/sec (±14.99%
)0.81
Async task#spawn task
37032
ops/sec (±0.7%
)27194
ops/sec (±3.62%
)0.73
Async task#ThreadSafeFunction
1827
ops/sec (±26.65%
)1493
ops/sec (±3.3%
)0.82
Async task#Tokio future to Promise
32863
ops/sec (±0.59%
)27053
ops/sec (±2%
)0.82
Query#query * 100
2098
ops/sec (±1.73%
)1546
ops/sec (±2.17%
)0.74
Query#query * 1
32075
ops/sec (±0.35%
)21866
ops/sec (±2.53%
)0.68
This comment was automatically generated by workflow using github-action-benchmark.