Profile and reduce Oxide code-image startup, peak RSS, and package size

Offen
#192 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
44/100
Issue-Typ
Refactoring
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
rust
Bereich
performance

Rechercherichtung

Start with the remaining initialization work: examine object, closure, and cell allocation and capped-heap accounting, then compare the identified Hero script-turn cost with QJBC. Use the existing Hero replay and report changes against the recorded instruction counts; image decoding and instantiation are also named areas to measure. The issue sets a separate rollout gate: record identical Tab5 release package results against the device QJBC ABI and exercise packaged workers before changing the default engine.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Baseline

Stock PocketJS Hero, Linux x86-64, same release replay host, same bundle and assets, 20 boot-only samples per engine in ABBA order.

Metric Oxide OXBC v2 QuickJS QJBC (NG 0.16.2)
Boot median 10.76 ms 6.33 ms
Median process peak RSS 10,776 KiB 8,046 KiB
UI bytecode section 480,993 B 148,909 B

The compiler-free Oxide host matched QJBC for all 360 replay frames, the ordered host-call trace, and the final framebuffer.

Work

  • Account for bytecode bytes by section and attribute startup instructions and allocation peaks across package admission, realm and host setup, decode, relocation/publication, instantiation, and first execution.
  • Land and measure the first round of improvements to the dominant costs. Recheck the same Hero replay, format rejection before execution, no-draw boot, process peak RSS, UI bytecode bytes and the engine Sweep.
  • Validate the rollout on Tab5 with the release ESP-IDF QuickJS QJBC ABI and exercise the PocketJS worker path. Record that evidence before changing the default engine.

First optimization round

The paired rerun used Linux CPU 2, the same original Hero bundle and assets, and 20 boot-only samples per arm. QJBC ran through the existing PocketJS C guest.

Metric OXBC v2 OXBC v3 QuickJS QJBC
Boot median 10.85 ms 9.00 ms 6.34 ms
Median boot peak RSS 10,728 KiB 9,628 KiB 8,092 KiB
UI bytecode section 480,993 B 289,412 B 148,909 B
  • Fixed-width instructions and position tables accounted for 79.8% of OXBC v2. V3 uses variable-width immediates and delta-coded source positions and preserves backtraces.
  • Massif attributed 1,034,592 bytes to an eager copy of the asset pak. When the native registry has mounted assets, the guest creates the private __pak buffer on first access. Massif's sampled live allocation peak dropped from 5,667,338 to 4,441,015 bytes.
  • Loading now validates the relocated tree's input once and uses its explicit tree links for instantiation. Callgrind attributed 17.68M instructions to v2 loading and 12.37M to v3 loading.
  • The capped heap skips growth calculations for arenas with zero requested records. The capacity-check work dropped from 11.55M to 10.25M instructions at the same 19,228 checks. One collection ran on the profiled boot.
  • The compiler-free host still matched QJBC for 360 frames, the host operation log and the final pixels. The release build rejects v2 before effects, and a v3 exception after a host operation stops startup. The instruction and loop-size Sweep gates passed after refreshing linker symbol ordering. The 37-workload engine peak-RSS geometric mean was 0.998×.

Remaining

  • Reduce the initialization cost. Hero's Oxide script turn accounts for 42.00M instructions compared with 28.52M in QJBC's script execution. Examine object, closure and cell allocation and capped-heap accounting. Image decoding and instantiation still account for 7.72M and 4.65M instructions respectively.
  • Measure identical Tab5 release packages against the device QJBC ABI and exercise packaged workers. The Linux QJBC results above are for the native diagnostic ABI.
Vorherrschende Sprache
Rust
Sterne
61
Forks
2
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Die Einrichtungsdateien dieses Projekts haben wir noch nicht geprüft. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus pocket-stack/quickjs-oxide

Alle Issues in pocket-stack/quickjs-oxide

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.