Skip to content

perf(python): avoid full duplicate semantic analysis before encoding overrides #162

Closed

Description

@spboyer

Parent

#160

Validated finding

At a794557384adcc3293a77043f6b9aff1c33d152c, packages/flint-py/flint/vegalite/assemble.py:143 runs full resolve_channel_semantics to enrich encoding types before overrides, then calls the same full resolver again at line 176. The preliminary caller only consumes the inferred type. The current JS analysis pipeline already separates type resolution from full semantic resolution and is useful prior art.

Revalidated 2026-11-11 with a 10,000-row Scatter Plot (x/y quantities, 20 color groups, unused Year field). Unprofiled earlier median assembly was approximately 156 ms over five runs. A fresh cProfile run recorded 0.628 s total instrumented time, including two resolve_channel_semantics calls totaling 0.219 s and six resolve_field_semantics calls. Instrumented attribution is not production latency and does not demonstrate a speedup.

Environment: shared Linux host, two visible CPUs, Python 3.12.3. Upstream issue listings and all 21 open PR titles were checked on 2026-11-11; no equivalent work was found. Existing golden-fixture drift is separately tracked by #80 and must not be silently rewritten as part of this work.

Proposed scope

Use a type-only preliminary pass, or an equivalently narrow internal approach, before composing overrides. Do not cache final channel semantics across changed channel bindings. Keep the final full semantic resolution authoritative.

Acceptance criteria

  • Preserve shorthand encodings, field-less count aggregation, explicit types, facet coercion, ISO-like temporal inference, axis dtype overrides, sort/encoding actions, color annotations, and final output.
  • Reuse existing Python helpers and JS prior art rather than copying all full-resolution logic.
  • Add focused regression cases for preliminary-type-sensitive overrides and compare representative chart outputs against baseline.
  • Publish at least three interleaved baseline/change rounds for 1k/10k rows, with timing and allocation/peak-memory evidence, identities, and raw measurements.
  • Classify pre-existing fixture failures separately from regressions.
  • No public API or behavior changes; one focused PR, no automatic merge.

Activity

  1. Chenglong-MS commented on Nov 15, 2026

    @Chenglong-MS
    Contributor

    Fixed by #170 (merged into dev): only preliminary encoding types are resolved before overrides are composed. Ships in 1.0.2.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions