Skip to content

Track identity-function optimization audit #815

@He-Pin

Description

@He-Pin

Summary

Track an audit/purge pass for identity-function optimizations in sjsonnet.

Identity-function fast paths can be valid and useful, especially for standard-library defaults such as keyF=id or simple pipeline cleanup. The risk is that they can also become too broad, turning user code into a semantic proof problem and making benchmark results harder to interpret.

This issue is for separating the safe, intentional identity optimizations from speculative or benchmark-shaped ones.

Goals

  • Inventory every place that detects or assumes an identity function.
  • Keep identity fast paths that are tied to explicit stdlib semantics or common pipeline simplification.
  • Remove or narrow identity detection that tries to prove arbitrary user functions are extensionally identity.
  • Make benchmark claims avoid depending on identity-only workloads unless the optimization is explicitly about identity elimination.
  • Add tests that pin evaluation behavior, especially laziness, errors, traces, and tailstrict boundaries.

Candidate Areas

  • keyF=id paths in std.sort, std.uniq, std.set, and related set operations.
  • std.map(function(x) x, arr) and whether it should exist as a narrow, explicit optimization.
  • Function-body structural checks such as function(x) x.
  • Any call-time identity detection that forces captured bindings or walks function composition chains.
  • Benchmarks whose primary win comes from treating a function as identity.

Acceptance Criteria

  • Identity fast paths are documented as either semantic stdlib defaults or narrow structural optimizations.
  • No broad call-time identity proof remains unless it has a separate design note and targeted benchmarks.
  • Tests cover lazy/error behavior for kept optimizations.
  • PR descriptions and benchmark tables clearly separate identity-elimination wins from generic array/runtime wins.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions