Skip to content

fix(native): avoid reparsing lipo output in list_architectures #174

Closed

Description

@morluto

Problem

In NativeMacOSProvider.#listArchitectures, the lipo output is parsed twice:

  • once for items
  • once again to compute total

This doubles parsing work for every list_architectures call.

Location

src/native/NativeMacOSProvider.ts:204-205

Why this is a bug

parseLipoArchitectures() does full tokenization and schema-validated transforms. Re-running it is redundant and can become an unnecessary CPU cost for large lipo -detailed_info outputs.

Impact

  • Extra latency in architecture enumeration on multi-architecture binaries.
  • Duplicate work in a hot utility path used by every contract that inspects native architectures.

Proposed fix

Cache parsed architectures once and reuse:

const architectures = parseLipoArchitectures(capture.value.stdout);
const result = listArchitecturesSchema.parse({
  architectures: {
    items: architectures,
    total: architectures.length,
    exhaustive: true,
    limitations: [],
  },
  ...
});

Activity

  1. added
    bug
    area: native
    on Oct 12, 2026
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

    area: nativebug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions