koffi 3.0.0-rc.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/doc/benchmarks.md CHANGED
@@ -8,6 +8,7 @@ Here is a quick overview of the execution time of Koffi calls on three benchmark
8
8
 
9
9
  <div class="benchmark chart" data-platform="linux_x64"></div>
10
10
  <div class="benchmark chart" data-platform="win32_x64"></div>
11
+ <div class="benchmark chart" data-platform="darwin_arm64"></div>
11
12
 
12
13
  These results are detailed and explained below, and compared to node-ffi/node-ffi-napi.
13
14
 
@@ -57,6 +58,30 @@ This test is based around repeated calls to the standard C function `memset`. Al
57
58
 
58
59
  <div class="benchmark table" data-platform="win32_x64" data-benchmark="memset"></div>
59
60
 
61
+ # macOS ARM64
62
+
63
+ The results presented below were measured on an Apple Mac mini M2 hosted by Scaleway.
64
+
65
+ ## rand results
66
+
67
+ This test is based around repeated calls to a simple standard C function `rand`, which takes no parameter and returns a 32-bit integer.
68
+
69
+ <div class="benchmark table" data-platform="darwin_arm64" data-benchmark="rand"></div>
70
+
71
+ Because rand is a pretty small function, the FFI overhead is clearly visible.
72
+
73
+ ## atoi results
74
+
75
+ This test is similar to the rand one, but it is based on `atoi`, which takes a string parameter. Javascript (V8) to C string conversion is relatively slow and heavy.
76
+
77
+ <div class="benchmark table" data-platform="darwin_arm64" data-benchmark="atoi"></div>
78
+
79
+ ## memset results
80
+
81
+ This test is based around repeated calls to the standard C function `memset`. All implementations pass a Node.js Buffer for the pointer argument.
82
+
83
+ <div class="benchmark table" data-platform="darwin_arm64" data-benchmark="memset"></div>
84
+
60
85
  # Running benchmarks
61
86
 
62
87
  Please note that all benchmark results on this page are made with Clang-built binaries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koffi",
3
- "version": "3.0.0-rc.1",
3
+ "version": "3.0.0",
4
4
  "description": "Fast and simple C FFI (foreign function interface) for Node.js",
5
5
  "keywords": [
6
6
  "foreign",
@@ -33,20 +33,20 @@
33
33
  },
34
34
  "funding": "https://liberapay.com/Koromix",
35
35
  "optionalDependencies": {
36
- "@koromix/koffi-linux-arm64": "3.0.0-rc.1",
37
- "@koromix/koffi-linux-ia32": "3.0.0-rc.1",
38
- "@koromix/koffi-linux-x64": "3.0.0-rc.1",
39
- "@koromix/koffi-linux-riscv64d": "3.0.0-rc.1",
40
- "@koromix/koffi-freebsd-ia32": "3.0.0-rc.1",
41
- "@koromix/koffi-freebsd-x64": "3.0.0-rc.1",
42
- "@koromix/koffi-freebsd-arm64": "3.0.0-rc.1",
43
- "@koromix/koffi-openbsd-ia32": "3.0.0-rc.1",
44
- "@koromix/koffi-openbsd-x64": "3.0.0-rc.1",
45
- "@koromix/koffi-win32-ia32": "3.0.0-rc.1",
46
- "@koromix/koffi-win32-x64": "3.0.0-rc.1",
47
- "@koromix/koffi-darwin-x64": "3.0.0-rc.1",
48
- "@koromix/koffi-darwin-arm64": "3.0.0-rc.1",
49
- "@koromix/koffi-linux-loong64": "3.0.0-rc.1"
36
+ "@koromix/koffi-linux-arm64": "3.0.0",
37
+ "@koromix/koffi-linux-ia32": "3.0.0",
38
+ "@koromix/koffi-linux-x64": "3.0.0",
39
+ "@koromix/koffi-linux-riscv64": "3.0.0",
40
+ "@koromix/koffi-freebsd-ia32": "3.0.0",
41
+ "@koromix/koffi-freebsd-x64": "3.0.0",
42
+ "@koromix/koffi-freebsd-arm64": "3.0.0",
43
+ "@koromix/koffi-openbsd-ia32": "3.0.0",
44
+ "@koromix/koffi-openbsd-x64": "3.0.0",
45
+ "@koromix/koffi-win32-ia32": "3.0.0",
46
+ "@koromix/koffi-win32-x64": "3.0.0",
47
+ "@koromix/koffi-darwin-x64": "3.0.0",
48
+ "@koromix/koffi-darwin-arm64": "3.0.0",
49
+ "@koromix/koffi-linux-loong64": "3.0.0"
50
50
  },
51
51
  "type": "module",
52
52
  "main": "./index.cjs",
@@ -131,7 +131,7 @@ var init_abi = __esm({
131
131
  var package_default;
132
132
  var init_package = __esm({
133
133
  "package.json"() {
134
- package_default = { name: "koffi", version: "3.0.0-rc.1", cnoke: { api: "../../vendor/node-api-headers", output: "../../bin/Koffi/{{ toolchain }}", node: 16, napi: 8 } };
134
+ package_default = { name: "koffi", version: "3.0.0", cnoke: { api: "../../vendor/node-api-headers", output: "../../bin/Koffi/{{ toolchain }}", node: 16, napi: 8 } };
135
135
  }
136
136
  });
137
137
 
@@ -251,8 +251,8 @@ var require_static = __commonJS({
251
251
  } catch (err) {
252
252
  }
253
253
  try {
254
- if (pkg2 == "linux-riscv64d")
255
- native2 = requireNative2("../../../@koromix/koffi-linux-riscv64d");
254
+ if (pkg2 == "linux-riscv64")
255
+ native2 = requireNative2("../../../@koromix/koffi-linux-riscv64");
256
256
  } catch (err) {
257
257
  }
258
258
  try {
@@ -94,7 +94,7 @@ function decodeElfHeader(buf) {
94
94
  }
95
95
 
96
96
  // package.json
97
- var package_default = { name: "koffi", version: "3.0.0-rc.1", cnoke: { api: "../../vendor/node-api-headers", output: "../../bin/Koffi/{{ toolchain }}", node: 16, napi: 8 } };
97
+ var package_default = { name: "koffi", version: "3.0.0", cnoke: { api: "../../vendor/node-api-headers", output: "../../bin/Koffi/{{ toolchain }}", node: 16, napi: 8 } };
98
98
 
99
99
  // src/init.js
100
100
  var requireNative = createRequire(import.meta.url);
@@ -194,8 +194,8 @@ function loadStatic(pkg2) {
194
194
  } catch (err) {
195
195
  }
196
196
  try {
197
- if (pkg2 == "linux-riscv64d")
198
- native2 = requireNative2("../../../@koromix/koffi-linux-riscv64d");
197
+ if (pkg2 == "linux-riscv64")
198
+ native2 = requireNative2("../../../@koromix/koffi-linux-riscv64");
199
199
  } catch (err) {
200
200
  }
201
201
  try {
@@ -131,7 +131,7 @@ var init_abi = __esm({
131
131
  var package_default;
132
132
  var init_package = __esm({
133
133
  "package.json"() {
134
- package_default = { name: "koffi", version: "3.0.0-rc.1", cnoke: { api: "../../vendor/node-api-headers", output: "../../bin/Koffi/{{ toolchain }}", node: 16, napi: 8 } };
134
+ package_default = { name: "koffi", version: "3.0.0", cnoke: { api: "../../vendor/node-api-headers", output: "../../bin/Koffi/{{ toolchain }}", node: 16, napi: 8 } };
135
135
  }
136
136
  });
137
137
 
@@ -251,8 +251,8 @@ var require_static = __commonJS({
251
251
  } catch (err) {
252
252
  }
253
253
  try {
254
- if (pkg2 == "linux-riscv64d")
255
- native2 = requireNative2("../../../@koromix/koffi-linux-riscv64d");
254
+ if (pkg2 == "linux-riscv64")
255
+ native2 = requireNative2("../../../@koromix/koffi-linux-riscv64");
256
256
  } catch (err) {
257
257
  }
258
258
  try {
@@ -94,7 +94,7 @@ function decodeElfHeader(buf) {
94
94
  }
95
95
 
96
96
  // package.json
97
- var package_default = { name: "koffi", version: "3.0.0-rc.1", cnoke: { api: "../../vendor/node-api-headers", output: "../../bin/Koffi/{{ toolchain }}", node: 16, napi: 8 } };
97
+ var package_default = { name: "koffi", version: "3.0.0", cnoke: { api: "../../vendor/node-api-headers", output: "../../bin/Koffi/{{ toolchain }}", node: 16, napi: 8 } };
98
98
 
99
99
  // src/init.js
100
100
  var requireNative = createRequire(import.meta.url);