porffor 0.60.8 → 0.60.10
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/compiler/2c.js +2 -2
- package/compiler/assemble.js +13 -0
- package/compiler/builtins/regexp.ts +180 -36
- package/compiler/builtins.js +79 -69
- package/compiler/builtins_precompiled.js +2160 -2160
- package/compiler/codegen.js +73 -63
- package/compiler/cyclone.js +2 -2
- package/compiler/disassemble.js +2 -2
- package/compiler/encoding.js +22 -4
- package/compiler/expression.js +0 -25
- package/compiler/opt.js +15 -15
- package/compiler/precompile.js +4 -4
- package/compiler/wrap.js +4 -1
- package/foo.js +34 -0
- package/package.json +2 -2
- package/runtime/index.js +1 -1
package/foo.js
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
// benchmark.js
|
2
|
+
const ITER = 50_000_000; // 50 million iterations
|
3
|
+
const key = "a";
|
4
|
+
|
5
|
+
// Create a null-prototype object
|
6
|
+
const o = Object.create(null);
|
7
|
+
o[key] = 123;
|
8
|
+
|
9
|
+
// --- Benchmark "in" ---
|
10
|
+
const t1 = Date.now();
|
11
|
+
for (let i = 0; i < ITER; i++) {
|
12
|
+
if (key in o) {
|
13
|
+
// noop
|
14
|
+
}
|
15
|
+
}
|
16
|
+
console.log(`in: ${Date.now() - t1}ms`);
|
17
|
+
|
18
|
+
// --- Benchmark Object.hasOwn ---
|
19
|
+
const t2 = Date.now();
|
20
|
+
for (let i = 0; i < ITER; i++) {
|
21
|
+
if (Object.hasOwn(o, key)) {
|
22
|
+
// noop
|
23
|
+
}
|
24
|
+
}
|
25
|
+
console.log(`Object.hasOwn: ${Date.now() - t2}ms`);
|
26
|
+
|
27
|
+
// --- Benchmark o[k] ---
|
28
|
+
const t3 = Date.now();
|
29
|
+
for (let i = 0; i < ITER; i++) {
|
30
|
+
if (o[key] !== undefined) {
|
31
|
+
// noop
|
32
|
+
}
|
33
|
+
}
|
34
|
+
console.log(`o[k]: ${Date.now() - t3}ms`);
|
package/package.json
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"name": "porffor",
|
3
3
|
"description": "An ahead-of-time JavaScript compiler",
|
4
|
-
"version": "0.60.
|
4
|
+
"version": "0.60.10",
|
5
5
|
"author": "Oliver Medhurst <honk@goose.icu>",
|
6
6
|
"license": "MIT",
|
7
7
|
"scripts": {},
|
8
8
|
"dependencies": {
|
9
9
|
"acorn": "^8.15.0",
|
10
|
-
"node-repl-polyfill": "
|
10
|
+
"node-repl-polyfill": "^0.1.2"
|
11
11
|
},
|
12
12
|
"optionalDependencies": {
|
13
13
|
"@babel/parser": "^7.24.4",
|