Skip to content

Conversation

@Unisay
Copy link
Contributor

@Unisay Unisay commented Nov 26, 2025

Summary

Updates the valueContainsArgs benchmark generator to accurately reflect the isSubmapOfBy algorithm introduced in #7344.

Problem: The comment and code still described the old lookup-based algorithm where each entry in contained triggered an independent lookup from the root of the container BST. This was misleading after the change to Map.isSubmapOfBy.

Changes:

  • Updated comment to describe the splitLookup-based divide-and-conquer algorithm
  • Removed ~30 lines of "deepest entry" selection logic that was designed for the old algorithm but has no effect on isSubmapOfBy (entry order in the list is irrelevant - BST structure determines traversal)
  • Removed unused find import

What's preserved:

  • ~1000 worst-case test points with same parameter coverage
  • Power-of-2 size grid for systematic BST depth coverage
  • Worst-case ByteString keys (long common prefix, differ in last 4 bytes)
  • Subset relationship ensuring no early exit from missing keys

Technical Context

The old algorithm did n independent lookups from root, making "deepest entry" targeting meaningful. The new isSubmapOfBy algorithm uses splitLookup to divide-and-conquer: after the first split, subsequent lookups happen in subtrees, not from root. Kenneth correctly noted this discrepancy.

Test plan

  • Build compiles with --ghc-options=-Werror
  • Benchmark still generates ~1000 test cases (structure unchanged)

The valueContainsArgs benchmark comment described the old lookup-based
algorithm. After PR #7344, valueContains uses Map.isSubmapOfBy which
employs a splitLookup-based divide-and-conquer traversal.

Changes:
- Update comment to accurately describe isSubmapOfBy behavior
- Remove unused "deepest entry" selection logic (~30 lines)
- Remove unused `find` import

The benchmark still generates ~1000 worst-case test points with the same
parameter coverage (power-of-2 sizes, worst-case keys, subset relationship).
The simplification removes code that was targeting the old algorithm's
traversal pattern but had no effect on isSubmapOfBy.
@Unisay Unisay marked this pull request as draft November 26, 2025 11:46
@Unisay Unisay self-assigned this Nov 26, 2025
@Unisay Unisay added the No Changelog Required Add this to skip the Changelog Check label Nov 26, 2025
… and builtinCostModelC

- Adjusted the 'intercept' value from 1163050 to 1160605
- Updated the 'slope' value from 1470 to 1553

These changes reflect a refinement in the cost estimation for CPU usage in the valueContains section of the cost models.
@Unisay
Copy link
Contributor Author

Unisay commented Nov 26, 2025

newplot newplot1 newplot2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No Changelog Required Add this to skip the Changelog Check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants