GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: runtime improvements by NathanWalker · Pull Request #52 · NativeScript/rfcs

Conversation

@NathanWalker

@NathanWalker NathanWalker commented Feb 28, 2026

Copy link
Copy Markdown

0) Context and Motivation

Criticisms:

  • "I can't prove the performance envelope."
  • "Debugging across JS<->native is not deterministic enough."
  • "Memory and lifecycle rules feel too implicit."
  • "Tooling doesn't show me where time and memory went."

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

  1. Performance Predictability
    Reduce tail latency and eliminate random jank spikes.

  2. Explicit Ownership & Lifecycle
    Make object lifetime across JS and native deterministic and
    enforceable.

  3. Observability-First Runtime
    Make it easy to answer: "Why did this hitch?"

Secondary Goals

  1. Startup Consistency
  2. Safe Migration Path

Non-Goals

  • Rewriting the UI paradigm

2) Current Pain Points (Hypotheses)

  1. Boundary overhead is too dynamic (reflection, runtime dispatch).
  2. Ownership between JS and native is ambiguous.
  3. Threading rules are insufficiently enforced.
  4. Tooling does not unify JS and native execution clearly.

3) Principles

  1. Make the fast path the default path.
  2. Pay costs once, not per call.
  3. Ownership must be explicit and enforceable.
  4. Everything must be measurable.

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:

  • Borrowed
  • Owned
  • Pinned

Use stable numeric handles with handle tables internally.

Deliverables: - Handle table implementation - dispose() /
close() lifecycle hooks - Ownership annotations in schema - Dev-time
misuse warnings

Acceptance Criteria: - Leak snapshots identify retained native
objects - Misuse triggers actionable errors


4.3 Boundary Performance Improvements

  • Zero-copy typed arrays and buffers
  • Packed structs for common value types
  • Batched UI transactions

Acceptance Criteria: - Reduced boundary call count - Improved
p95/p99 frame times


4.4 Threading Enforcement

  • Enforce UI-thread-only objects
  • Provide explicit scheduling primitives

Acceptance Criteria: - Clear errors for thread misuse


4.5 Observability & Profiling

  1. Unified JS + native timeline tracing
  2. Boundary profiler (top bindings, call counts, costs)
  3. Memory correlation (JS heap + native heap + handles)

Acceptance Criteria: - Performance issues diagnosable from captured
traces


4.6 Startup Improvements

  • Bytecode caching / snapshotting
  • Precomputed binding tables
  • Lazy loading of native APIs

Acceptance Criteria: - Improved cold-start p95


5) Migration Strategy

  • Phase 1: Ship with npm tag during acceptance cycle
  • Phase 2: Dual-path bindings (codegen + fallback)
  • Phase 3: Tooling for plugin migration
  • Phase 4: Default for new apps

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

  • Engineering scope
  • API surface complexity
  • Plugin inertia
  • Instrumentation overhead

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

  • Target engine constraints?
  • Current top boundary hot paths?
  • Ecosystem keystone plugins?
  • Schema ergonomics?

10) Predictability

We are making the runtime predictable:

  • Static, measurable boundary calls
  • Explicit ownership
  • Unified profiling
  • Reasonable, enforceable semantics

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

dyazincahya, triniwiz, herefishyfish, and haikyuu reacted with thumbs up emoji
All reactions
  • 👍 4 reactions
@NathanWalker
chore: cleanup
980b63b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@NathanWalker
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.