Skip to content

Engine: typed-array path for rule configs (Fourier lab skips ~3 MB of JSON at 50k) - #17

Merged
benjamin-small merged 1 commit into
mainfrom
feat/typed-array-path
Sep 8, 2026
Merged

Engine: typed-array path for rule configs (Fourier lab skips ~3 MB of JSON at 50k)#17
benjamin-small merged 1 commit into
mainfrom
feat/typed-array-path

Conversation

@benjamin-small

Copy link
Copy Markdown
Owner

Adds Engine::update_rule_config_with_path(cfg, xy: Float32Array, pen: Uint8Array): the bulk path crosses the WASM boundary as zero-copy typed-array views while only scalar fields go through JSON. Generic Rule::apply_path hook (default unsupported; Fourier implements it with a shape check), set_config_with_path (atomic) and config_json (on-demand serialization, so rule_config() reflects typed-array pushes) on the erased layer, packPath() + LabApi.setRuleConfigWithPath() on the web side. Tests on all layers.

Engine::update_rule_config_with_path(cfg, xy: &[f32], pen: &[u8]) takes
the path as zero-copy typed-array views (JS passes a Float32Array of
interleaved x/y and a Uint8Array of pen flags) and only the scalar
fields as JSON. Backed by a generic Rule::apply_path hook (default:
unsupported) that the Fourier rule implements with a shape check;
the erased layer gains set_config_with_path (atomic) and config_json
(the typed config serialized on demand, so rule_config() can never be
stale). The lab packs its path with packPath() and uses the new call —
at 50k epicycles that removes ~3 MB of JSON per push.

Tests: Rust +3 native (apply_path, erased accept/reject), +2 browser
(typed path round-trip incl. rule_config(), shape/rule errors);
web +1 (packPath) and the lab tests now assert on the typed-array call.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@benjamin-small
benjamin-small merged commit 7d8b08f into main Sep 8, 2026
6 checks passed
@benjamin-small
benjamin-small deleted the feat/typed-array-path branch September 8, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant