Skip to content

Embedding: optimize Zig, C, private ABI, and Objective-C boundaries #495

Description

@chrisbbreuer

Parent: #459
Depends on: #460, #461, #463, #473, #479

Goal

Make Zig, public C, private ABI, and Objective-C host boundaries low-overhead for realistic embedding patterns while preserving all handle/lifetime/exception/affinity contracts.

Scope

  • Add symmetric host-boundary benchmarks for evaluate/compile, direct function/method/constructor calls, native callbacks, property/index access, strings UTF-8/UTF-16, typed arrays/no-copy buffers, protect/unprotect, context groups/realms, promises/jobs, modules, inspector, and ObjC/Foundation conversion.
  • Attribute boxing/handle lookup, context/realm validation, string conversion/copy, argument marshalling, callbacks/reentrancy, exception projection, locks, GC protection/barriers, and allocator traffic.
  • Add borrowed/owned views, batched operations, cached descriptors, or direct native stubs only when lifetime, mutation, relocation, and ABI behavior remain exact.
  • Keep public/private profile layouts and version pins immutable unless an intentional versioned contract change is made.
  • Compare system JSC only for exact public/ObjC API-equivalent calls; report zig-js extensions separately.

No-workaround rules

  • No raw internal pointer leak, skipped affinity/realm validation, unrooted borrowed value, elided exception, mutable buffer alias beyond contract, or benchmark-only unsafe API.

Acceptance

Foundation

Completed public/private/ObjC profiles under #135/#138/#140 and their linked inventories; stable embedding docs in docs/api.md.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    embeddingZig, C, private ABI, and Objective-C embeddingenhancementNew feature or requestperformanceMeasured runtime, memory, scaling, or build performance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions