relaxnative 0.1.3 → 0.1.5
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/dist/chunk-2KRTGQYD.js +898 -0
- package/dist/chunk-4TYB2LNW.js +1052 -0
- package/dist/chunk-5OGJZMKW.js +847 -0
- package/dist/chunk-AIVJY3DV.js +836 -0
- package/dist/chunk-BNACBSBG.js +898 -0
- package/dist/chunk-CNN72QHA.js +440 -0
- package/dist/chunk-GKVUUIR2.js +443 -0
- package/dist/chunk-SOYA3COP.js +898 -0
- package/dist/cli.js +33 -4
- package/dist/index.js +3 -3
- package/dist/memory/memory.selftest.js +2 -2
- package/dist/worker/processEntry.js +1 -1
- package/dist/worker/workerEntry.js +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
removePackage,
|
|
11
11
|
runNativeTests,
|
|
12
12
|
updateIndex
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-SOYA3COP.js";
|
|
14
14
|
import {
|
|
15
15
|
detectCompilers,
|
|
16
16
|
getCacheRoot
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-5OGJZMKW.js";
|
|
18
18
|
import "./chunk-HBO7F7P4.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-GKVUUIR2.js";
|
|
20
20
|
import "./chunk-MLKGABMK.js";
|
|
21
21
|
|
|
22
22
|
// src/cli.ts
|
|
@@ -64,6 +64,7 @@ Notes:
|
|
|
64
64
|
- Trust levels: local (no prompts), community (warning + confirmation), verified (silent install, requires signature)
|
|
65
65
|
- Add: pass --yes to make the command non-interactive (community installs will fail unless previously trusted)
|
|
66
66
|
- Bench: pass --traditional to include a JS baseline when available (built-in for add)
|
|
67
|
+
- Bench: --traditional requires --baseline <path> + --args "[...]" so both JS and native get the same inputs
|
|
67
68
|
`);
|
|
68
69
|
}
|
|
69
70
|
function fmtOk(msg) {
|
|
@@ -179,6 +180,7 @@ async function main() {
|
|
|
179
180
|
const iterationsRaw = getFlagValue(process.argv, "--iterations");
|
|
180
181
|
const warmupRaw = getFlagValue(process.argv, "--warmup");
|
|
181
182
|
const argsRaw = getFlagValue(process.argv, "--args");
|
|
183
|
+
const jsBaselinePath = getFlagValue(process.argv, "--baseline");
|
|
182
184
|
const json = hasFlag(process.argv, "--json");
|
|
183
185
|
const traditional = hasFlag(process.argv, "--traditional");
|
|
184
186
|
const confirm = hasFlag(process.argv, "--confirm");
|
|
@@ -203,6 +205,32 @@ async function main() {
|
|
|
203
205
|
process.exit(1);
|
|
204
206
|
}
|
|
205
207
|
}
|
|
208
|
+
let baseline;
|
|
209
|
+
if (traditional) {
|
|
210
|
+
if (!jsBaselinePath) {
|
|
211
|
+
console.error("Missing --baseline <path>. Example: --baseline ./benchmarks/matmul.js");
|
|
212
|
+
process.exit(1);
|
|
213
|
+
}
|
|
214
|
+
try {
|
|
215
|
+
const mod = await import(jsBaselinePath);
|
|
216
|
+
baseline = mod?.default ?? mod?.baseline ?? mod?.fn;
|
|
217
|
+
if (typeof baseline !== "function") {
|
|
218
|
+
console.error(
|
|
219
|
+
"Invalid baseline module: expected a default export (or named export baseline/fn) that is a function."
|
|
220
|
+
);
|
|
221
|
+
process.exit(1);
|
|
222
|
+
}
|
|
223
|
+
} catch (e) {
|
|
224
|
+
console.error("Failed to import baseline module:", e?.message ?? String(e));
|
|
225
|
+
process.exit(1);
|
|
226
|
+
}
|
|
227
|
+
if (!Array.isArray(args)) {
|
|
228
|
+
console.error(
|
|
229
|
+
"When using --traditional you must also pass --args as a JSON array so the baseline and native get identical inputs."
|
|
230
|
+
);
|
|
231
|
+
process.exit(1);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
206
234
|
const iterations = iterationsRaw ? Number(iterationsRaw) : 5e4;
|
|
207
235
|
const warmup = warmupRaw ? Number(warmupRaw) : 2e3;
|
|
208
236
|
trace("bench parsed flags", { iterations, warmup, hasArgs: Array.isArray(args) });
|
|
@@ -225,7 +253,8 @@ async function main() {
|
|
|
225
253
|
const res = await benchmarkCompareTraditionalVsRelaxnative(nativeFile, fnName, {
|
|
226
254
|
iterations,
|
|
227
255
|
warmup,
|
|
228
|
-
args
|
|
256
|
+
args,
|
|
257
|
+
baseline
|
|
229
258
|
});
|
|
230
259
|
trace("bench traditional: done");
|
|
231
260
|
if (json) console.log(JSON.stringify(res, null, 2));
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
runNativeTests,
|
|
25
25
|
trustPolicy,
|
|
26
26
|
updateIndex
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-SOYA3COP.js";
|
|
28
28
|
import {
|
|
29
29
|
alloc,
|
|
30
30
|
allocRaw,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
loadNativeDevHot,
|
|
38
38
|
loadNativeWithBindings,
|
|
39
39
|
memory_exports
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-5OGJZMKW.js";
|
|
41
41
|
import "./chunk-HBO7F7P4.js";
|
|
42
42
|
import {
|
|
43
43
|
InvalidFreeError,
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
NativePointer,
|
|
47
47
|
NullPointerError,
|
|
48
48
|
UseAfterFreeError
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-GKVUUIR2.js";
|
|
50
50
|
import "./chunk-MLKGABMK.js";
|
|
51
51
|
|
|
52
52
|
// src/registry/loadRegistry.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
alloc,
|
|
3
3
|
loadNative
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-5OGJZMKW.js";
|
|
5
5
|
import "../chunk-HBO7F7P4.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-GKVUUIR2.js";
|
|
7
7
|
import "../chunk-MLKGABMK.js";
|
|
8
8
|
|
|
9
9
|
// src/memory/memory.selftest.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "relaxnative",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Zero-config native C/C++/Rust execution for Node.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
],
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsup src/index.ts src/cli.ts src/worker/workerEntry.ts src/worker/processEntry.ts src/esmLoader.ts src/memory/memory.selftest.ts --format esm --dts",
|
|
40
|
-
"test": "vitest --run
|
|
40
|
+
"test": "vitest --run",
|
|
41
41
|
"test:inband": "vitest --run --pool=forks --maxWorkers=1",
|
|
42
42
|
"test:native": "vitest --run --pool=forks --maxWorkers=1 src/memory/memory.test.ts",
|
|
43
43
|
"test:threads": "vitest --run --pool=threads --maxWorkers=1",
|