js-on-sx: harness cache — precompute HARNESS_STUB SX once per run
Root cause: every sx_server worker session used js-eval on the 3.6KB HARNESS_STUB, paying ~15s for tokenize+parse+transpile even though every session does the same thing. Over a full scoreboard with periodic worker restarts that's minutes of wasted work. Fix: transpile once per Python process. Spin up a throwaway sx_server, run (inspect (js-transpile (js-parse (js-tokenize HARNESS_STUB)))), write the resulting SX source to lib/js/.harness-cache/stub.<fingerprint>.sx and a stable-name symlink-ish copy stub.sx. Every worker session then does a single (load .harness-cache/stub.sx) instead of re-running js-eval. Fingerprint: sha256(HARNESS_STUB + lexer.sx + parser.sx + transpile.sx). Transpiler edits invalidate the cache automatically. Runs back-to-back reuse the cache — only the first run after a transpiler change pays the ~15s precompute. Transpile had to gain a $-to-_js_dollar_ name-mangler: the SX tokenizer rejects $ in identifiers, which broke round-tripping via inspect. JS $DONOTEVALUATE → SX _js_dollar_DONOTEVALUATE. Internal JS-on-SX names are unaffected (none contain $). Measured: 300-test wide (Math+Number+String @ 100/cat, --per-test-timeout 5): 593.7s → 288.0s, 2.06x speedup. Scoreboard 114→115/300 (38.3%, noise band). Math 40%, Number 44%, String 30% — same shape as prior. Baselines: 520/522 unit, 148/148 slice — unchanged.
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"totals": {
|
||||
"pass": 118,
|
||||
"fail": 160,
|
||||
"pass": 115,
|
||||
"fail": 174,
|
||||
"skip": 1597,
|
||||
"timeout": 22,
|
||||
"timeout": 11,
|
||||
"total": 1897,
|
||||
"runnable": 300,
|
||||
"pass_rate": 39.3
|
||||
"pass_rate": 38.3
|
||||
},
|
||||
"categories": [
|
||||
{
|
||||
@@ -35,46 +35,42 @@
|
||||
{
|
||||
"category": "built-ins/Number",
|
||||
"total": 340,
|
||||
"pass": 48,
|
||||
"fail": 45,
|
||||
"pass": 44,
|
||||
"fail": 52,
|
||||
"skip": 240,
|
||||
"timeout": 7,
|
||||
"pass_rate": 48.0,
|
||||
"timeout": 4,
|
||||
"pass_rate": 44.0,
|
||||
"top_failures": [
|
||||
[
|
||||
"Test262Error (assertion failed)",
|
||||
42
|
||||
52
|
||||
],
|
||||
[
|
||||
"Timeout",
|
||||
7
|
||||
],
|
||||
[
|
||||
"ReferenceError (undefined symbol)",
|
||||
3
|
||||
4
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"category": "built-ins/String",
|
||||
"total": 1223,
|
||||
"pass": 30,
|
||||
"fail": 56,
|
||||
"pass": 31,
|
||||
"fail": 63,
|
||||
"skip": 1123,
|
||||
"timeout": 14,
|
||||
"pass_rate": 30.0,
|
||||
"timeout": 6,
|
||||
"pass_rate": 31.0,
|
||||
"top_failures": [
|
||||
[
|
||||
"Test262Error (assertion failed)",
|
||||
43
|
||||
53
|
||||
],
|
||||
[
|
||||
"Timeout",
|
||||
14
|
||||
6
|
||||
],
|
||||
[
|
||||
"ReferenceError (undefined symbol)",
|
||||
7
|
||||
2
|
||||
],
|
||||
[
|
||||
"Unhandled: Not callable: \\\\\\",
|
||||
@@ -100,19 +96,19 @@
|
||||
"top_failure_modes": [
|
||||
[
|
||||
"Test262Error (assertion failed)",
|
||||
108
|
||||
128
|
||||
],
|
||||
[
|
||||
"TypeError: not a function",
|
||||
36
|
||||
37
|
||||
],
|
||||
[
|
||||
"Timeout",
|
||||
22
|
||||
11
|
||||
],
|
||||
[
|
||||
"ReferenceError (undefined symbol)",
|
||||
10
|
||||
2
|
||||
],
|
||||
[
|
||||
"Unhandled: Not callable: \\\\\\",
|
||||
@@ -129,9 +125,13 @@
|
||||
[
|
||||
"Unhandled: Not callable: {:__proto__ {}} (kont=5 frames)\\",
|
||||
1
|
||||
],
|
||||
[
|
||||
"Unhandled: js-transpile-binop: unsupported op: >>>\\",
|
||||
1
|
||||
]
|
||||
],
|
||||
"pinned_commit": "d5e73fc8d2c663554fb72e2380a8c2bc1a318a33",
|
||||
"elapsed_seconds": 429.3,
|
||||
"elapsed_seconds": 288.0,
|
||||
"workers": 1
|
||||
}
|
||||
Reference in New Issue
Block a user