Skip to content

Conversation

@sjakobi
Copy link
Member

@sjakobi sjakobi commented Oct 16, 2025

TODO:

  • Create a type synonym ShiftedHash with utilities like shiftSH, maskSH etc
  • Check the Core

This reduces the core size for the inner loop of two by 10 terms.
This results in a ~10% reduction in Code size for each of the insert
variants.

Closes #447.
* Use the "shifted hash" approach.
* Create a variant `two'` that can be used to address #468.
@sjakobi
Copy link
Member Author

sjakobi commented Oct 19, 2025

So far, I'm seeing speedups of 2–4% on benchmarks for fromList and union with 100–10.000 elements.

@sjakobi sjakobi marked this pull request as ready for review October 19, 2025 17:12
@sjakobi sjakobi marked this pull request as draft October 19, 2025 17:53
Comment on lines +964 to +967
-- | This function lives at the top-level so 'two' and `two'` can be inlined
-- without inlining this loop.
two_go :: ShiftedHash -> HashMap k v -> ShiftedHash -> HashMap k v -> ST s (HashMap k v)
two_go !sh1 t1 !sh2 t2
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having this loop at the top-level nicely reduces the bloat, but functions like union seem to get slower by up to 4% :/

@sjakobi
Copy link
Member Author

sjakobi commented Oct 19, 2025

I've extracted the (in my mind) unquestionable changes to #524.

I'll have another go at goDifferentHash etc once that is merged.

@sjakobi sjakobi closed this Oct 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant