Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
0) Context and Motivation
Criticisms:
This RFC proposes a runtime roadmap that directly addresses those
concerns by making boundary costs measurable and cheap, ownership
explicit, and profiling first-class.
1) Goals
Primary Goals
Performance Predictability
Reduce tail latency and eliminate random jank spikes.
Explicit Ownership & Lifecycle
Make object lifetime across JS and native deterministic and
enforceable.
Observability-First Runtime
Make it easy to answer: "Why did this hitch?"
Secondary Goals
Non-Goals
2) Current Pain Points (Hypotheses)
3) Principles
4) Proposal
4.1 Codegen-First Bindings
Move core bindings to a code-generated interface layer with static
dispatch.
Deliverables: - Binding schema format - JS wrappers + native stubs -
Marshaling fast paths - Tracepoints per binding
Acceptance Criteria: - Top 100 APIs use codegen path - Profiler
reports dynamic vs codegen usage
4.2 Explicit Ownership Model
Introduce ownership policies:
Use stable numeric handles with handle tables internally.
Deliverables: - Handle table implementation -
dispose()/close()lifecycle hooks - Ownership annotations in schema - Dev-timemisuse warnings
Acceptance Criteria: - Leak snapshots identify retained native
objects - Misuse triggers actionable errors
4.3 Boundary Performance Improvements
Acceptance Criteria: - Reduced boundary call count - Improved
p95/p99 frame times
4.4 Threading Enforcement
Acceptance Criteria: - Clear errors for thread misuse
4.5 Observability & Profiling
Acceptance Criteria: - Performance issues diagnosable from captured
traces
4.6 Startup Improvements
Acceptance Criteria: - Improved cold-start p95
5) Migration Strategy
6) Benchmarks & Metrics
Scenarios: - List scroll stress - Startup & first render - Navigation
churn - Animation/gesture pressure - Memory retention cycles
Metrics: - Frame time p50 / p95 / p99 - Boundary calls/sec - Marshaling
allocations/sec - Cold-start p95 - Retained native handles
7) Risks
8) Phased Plan
Phase A: Observability + Baseline Suite
Phase B: Ownership + Handle Tables
Phase C: Codegen for Hot APIs
Phase D: Zero-Copy + Batching
Phase E: Startup Optimization
9) Open Questions
10) Predictability
We are making the runtime predictable: