miserit-anthar
Trial port of imperial-lcars to hybriel (measurement for the wave decision)
opened by Nemesis · assigned to Caramboleyo
opened · updated
caramboleyo 2026-10-23: "maybe test a run with a full port. the own libs are not that big, should be possible with hybriel." Agreed in #17 (Arachne, Anton): a Nemesis worker ports imperial-lcars (/CONTAINERS/projects/imperial-lcars-next/src, 3 files, ~1,000 lines, no shaders) with hybriel --js against a PINNED binary (sha named by Anton), AFTER Anton's JS-externals mission (hybriel ticket number to be posted in #17; today hybriel cannot name three.js or the imperial libs). Acceptance: ported lib mounted into a dev lane as /imperial-lcars; LcarsBox#update probe pixel diff 0 px vs the JS lib; phone bars flow; desktop crop identical; output size vs the JS lib; per-frame cost of hybrid data crossing (hybriel deep-copies hybrid args; host objects by reference) measured; the LIST OF GAPS hit = the real result, each gap a ticket in project hybriel assigned to Anton. Blocked until Anton posts the externals ticket as done.
--- state 2026-10-24 03:59 open->progress
History
Nemesis opened the ticket imported from nemesis:hybriel-trial-port-lcars
Nemesis assigned the ticket to Nemesis Nemesis changed the state progress 8 comments
Nemesis changed the state pending Nemesis assigned the ticket to Caramboleyo 2 comments
Anton Nemesis edited
Edited once
Part 2c result: passing the fonts by reference helps a lot. I wrapped the hybriel LcarsBox in a thin JavaScript class that hands every font to the library as a class instance. One update of the main HUD box (20 updates, median of 5 runs on lane 3): JavaScript library 1.5 ms, hybriel build before 28.2 ms, hybriel build with the wrapper 12.3 ms. An update that changes nothing: 1.0 ms, 23.7 ms, 11.2 ms. Building the box: 0.7 ms, 1.5 ms, 1.3 ms. New text geometries per 20 updates (a stand-in for newly created Texts): JavaScript 60, hybriel before 2840 (about 142 per update), hybriel with wrapper 60, the same as JavaScript. So the Text cache hits again. A gap of roughly 8 times remains, which is the copying and dispatch cost Anton described. The HUD ring is still pixel identical to the JavaScript version (0 differing pixels, phone and desktop; at most 5 pixels off by 1 in two states). The wrapper lives only in the library mount, not in the game.
Nemesis edited the ticket Subject before:
Trial port of imperial-lcars to hybriel (measurement for the wave decision)Summary before
caramboleyo 2026-10-23: "maybe test a run with a full port. the own libs are not that big, should be possible with hybriel." Agreed in #17 (Arachne, Anton): a Nemesis worker ports imperial-lcars (/CONTAINERS/projects/imperial-lcars-next/src, 3 files, ~1,000 lines, no shaders) with
hybriel --jsagainst a PINNED binary (sha named by Anton), AFTER Anton's JS-externals mission (hybriel ticket number to be posted in #17; today hybriel cannot name three.js or the imperial libs). Acceptance: ported lib mounted into a dev lane as /imperial-lcars; LcarsBox#update probe pixel diff 0 px vs the JS lib; phone bars flow; desktop crop identical; output size vs the JS lib; per-frame cost of hybrid data crossing (hybriel deep-copies hybrid args; host objects by reference) measured; the LIST OF GAPS hit = the real result, each gap a ticket in project hybriel assigned to Anton. Blocked until Anton posts the externals ticket as done.Nemesis edited the ticket Subject before:
Decide whether the LCARS library port to Hybriel continuesSummary before
You asked for a trial: "maybe test a run with a full port. the own libs are not that big, should be possible with hybriel." The trial is done. The Hybriel version of the LCARS library draws the game's menu on the phone and on the desktop with no differing pixels in every state we tested.
The price: the shipped bundle is about twice as big (312 kB against 158 kB), and one layout update takes about 12 ms against 1.5 ms (still far below one frame). The compiler gaps we hit are tickets for Anton.
Continue means a worker swaps the library on a test lane for real use, headset and phone included, and keeps it in step with the JavaScript library until you decide which one lives. Stop means the trial stays as a measurement and the lane goes back to JavaScript.
Please answer: continue or stop?
2 comments
Nemesis Nemesis
Nemesis changed the state done
Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.
Write…
Write…
Write…
edited
Edited once
imperial-lcars port, part 2a (worker): the library build works, but the real LcarsBox still cannot be constructed with plain `new`. Pin checked: sha256 0136cb24… (master 45424ee5), the three new example folders (construct, host, lib) compile and give exactly their .expected output. What compiles as a library: `hybriel --js --lib src-hl/index.hl src-hl/helpers.hl src-hl/lcars-box.hl src-hl/button-controller.hl -o out-lib` (rc 0) writes index.mjs, helpers.mjs, lcars-box.mjs, button-controller.mjs plus one shared hl-runtime.js. Output is in /CONTAINERS/projects/imperial-lcars-hl/out-lib, build script tools/build-lib.sh. Confirmed gone (node 18, real three 0.183.2, real imperial-text-base and imperial-box-ui, headless): #217. Importing the four modules runs nothing, class LcarsBox is defined in exactly one module and lcars() returns an instance of that same class. Proof in rt-checks/part2a.md. Not usable for the real class: #216 and #219. `new LcarsBox(opts)` throws "the root of LcarsBox can suspend, so no synchronous construction exists — use `await LcarsBox.create(...)`". `await LcarsBox.create(opts)` honours opts and gives a construction digest (segs, contentArea, sides, bg, size, gap, minArm, colors, proxies) identical to the JS original for three option sets. update(), snapS(), lcars(), setSegmentColor() and the click handlers still answer Promises, and the cfg lambdas are async. Cause: the pin's "root cannot suspend" analysis treats Math.*, Map/WeakMap, Object.keys, Array.isArray, array map/sort/concat, `new` of another hybriel class and any call on a value read back from a hybrid array/object/parameter as suspending. A host shim for Math/Map/WeakMap plus loops instead of map/reduce did not help (still sync=false), so I reverted it (kept in src-hl-syncattempt/). Ticket hybriel #225. Still open: #218 (index.mjs exports only an empty class). Unchanged part-1 gaps (hybrid copy into host member, array fill, ?. ?? spread instanceof typeof in try/finally …) re-run on the pin and behave as before, so the part-1 counter workarounds stay. New tickets (assignee Anton): hybriel #225 sync-root analysis too narrow; #226 a static lambda that uses an `import js` name fails to compile when another file imports it (blocks the `static snapS = snapS` stand-in in index.hl); #227 concurrent `X.create(opts)` calls lose their opts (three parallel creates gave widths 111, 600, 600). Sizes (SIZE.md): modules 150376 B (lcars-box 137394, helpers 4615, button-controller 7066, index 1301) + runtime 241209 B = 391585 B vs 48482 B JS (8.1x); gzip lcars-box 25.5 kB, runtime 66.8 kB. helpers/index are no longer 147 kB bundles each. Part 2b needs: (1) construction as `await LcarsBox.create(opts)` and `await lcars(...)`, so the game call sites must become async or wait for #225; (2) import map entries for lane 3 (imperial-lcars is mapped to /imperial-lcars today): `"imperial-lcars/lcars-box": "/imperial-lcars-hl/lcars-box.mjs"`, `"imperial-lcars/helpers": "/imperial-lcars-hl/helpers.mjs"`, and keep `imperial-lcars` itself pointing at the JS lib (no re-exports before #218), with hl-runtime.js, button-controller.mjs, helpers.mjs, lcars-box.mjs, index.mjs and a package.json {"type":"module"} copied together into /imperial-lcars-hl/; lcars-box.mjs imports bare `three`, `imperial-text-base/registry`, `imperial-text-base/text`, helpers.mjs imports `imperial-box-ui/box` (all already in the lane map); (3) a real font to exercise Text (untested here: font {} breaks the JS original too), then the pixel probes and the copy-cost measurement.Write…
Write…
edited
Edited once
Write…
Write…
edited
Edited 2 times
Write…