Files
Glint-Runtime/docs/en

Glint Runtime — Documentation

Backend for executing compiled bytecode (.glbc) of the Glint UI framework. Loads bytecode, interprets VDOM, applies CSS-like styles, executes Rhai scripts, and renders the result via Iced (native GPU-accelerated GUI).

Project Structure

  • src/main.rs — entry point, CLI parsing
  • src/lib.rs — public API of the crate
  • src/app.rs — GlintApp: Iced application, update/view
  • src/cli.rs — CLI commands compile/run
  • src/renderer.rs — Iced widgets: Element → iced::Element conversion
  • src/perf.rs — PerfScope: performance measurement by phases
  • src/interpreter/mod.rs — Interpreter: bytecode loading, VDOM eval
  • src/interpreter/types.rs — Element, VNode, FlatVDom, Value, InternedStr, Document
  • src/interpreter/style.rs — StyleSheet, StyleRule, StyleIndex, StyleCache, ComputedStyle
  • src/interpreter/reactive.rs — ReactiveTracker: dependency graph
  • src/interpreter/rhei.rs — RheiContext: Rhai script integration
  • src/interpreter/reader.rs — Reader: .glbc bytecode reading
  • src/interpreter/opcodes.rs — OP_* bytecode constants
  • glt (compiler .gltm/.glts → .glbc)

Key Concepts

  • Document — loaded .glbc file: Element tree, style sheet, variables
  • Element — VDOM node: type_name, properties, children, computed_style, element_id, content_hash
  • VDOM — virtual tree, result of bytecode interpretation
  • StyleSheet — style sheet with indexed lookup and computed style cache
  • ReactiveTracker — tracks element → variable dependencies, dirty_set
  • RheiContext — compiles and executes Rhai scripts, caches AST
  • ComputedStyle — result of applying CSS rules: ~40 fields (color, padding, font-size, etc.)

Optimization Phases

See ARCHITECTURE-IMPROVEMENT-PLAN.md.

Implemented: phases 38, 10, 9.19.2 (content_hash, stable Iced widget IDs).

Remaining:

Phase Description Estimated Speedup
0 Profiling (bench, flamegraph)
1 Typed Values in styles instead of HashMap<String, String> 23×
2 String interning for hot paths 1.52×
9.3 Iced widget cache by content_hash 1.52× (render)