Skip to content

Bool gate costs ~46 Ir per builtin call (+2.9% on a builtin-heavy loop): make it structural #1654

Open

Description

@InauguralPhysicist

Measured in #1647 round 6 (callgrind, deterministic). The boolean type's per-call bool gate (eigs_call_builtin scanning arguments for a bool in a position the builtin does not declare) costs about 46 Ir per builtin call: +2.9% on a 50k-iteration loop of 4 builtin calls (368.1M → 378.8M Ir). On/off attribution: with the inline scan disabled, the loop measures 368.1M, so the scan is the entire cost. It is within the merge gate (5%), and the basic loop benches sit at +0.33%. But builtin-heavy consumers (DMG, iLambdaAi, eigen-sheet) pay it on every call.

Options (from the round-6 builder)

  • A bool-content flag on lists, set when a bool is stored, so the scan becomes one flag test.
  • Do the check when the argument list is built from slots, where the tag is already in hand.
  • A per-builtin declared-no-bool bit that skips the scan entirely for builtins that take no bool anywhere.

Done when

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:runtime-vmSubsystem: runtime-vmkind:decisionNeeds a decision recorded, not (only) code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions