Skip to content

Roadmap #80: optimize HashingVectorizer.transform #289

Closed

Description

@godofecht

Tracks roadmap rank 80: HashingVectorizer.transform.

Implementation evidence

PR #318 removes a redundant dense zeroing pass from hashing_vectorizer_transform. matrix_new is calloc-backed, so explicitly clearing every n_samples × n_features cell was pure duplicate work. The optimized path now computes one row base and accumulates token counts directly into row-major Matrix.data, making post-allocation work scale with observed token count rather than hash-space width.

A focused regression/benchmark fixture covers:

  • collision accumulation;
  • negative-token hash normalization;
  • untouched zero columns;
  • identical old-vs-new sparse workloads for A/B timing.

Validation evidence:

  • exact source/test passed the complete 34/34 tests+examples suite;
  • canonical benchmark/parity gate passed;
  • native wheel build and Python API tests passed;
  • scaled self-baseline performance gate passed;
  • rebased head also passed syntax, canonical parity, package, and the new three-sample median self-baseline gate.

The final rebase only incorporates main's #324 workflow change (freeze generated evidence on main), not source/runtime changes.

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