Skip to content

lib: improve performance of Mutable_Hash_Map when many succeeding hashes have conflicts#5954

Merged
simonvonhackewitz merged 4 commits intotokiwa-software:mainfrom
simonvonhackewitz:mutable_hash_map_bad_hash_optimization
Apr 16, 2026
Merged

lib: improve performance of Mutable_Hash_Map when many succeeding hashes have conflicts#5954
simonvonhackewitz merged 4 commits intotokiwa-software:mainfrom
simonvonhackewitz:mutable_hash_map_bad_hash_optimization

Conversation

@simonvonhackewitz
Copy link
Copy Markdown
Collaborator

requires #5903 to be fixed

@simonvonhackewitz simonvonhackewitz added modules related to Fuzion modules cleanup improve code quality labels Sep 15, 2025
@simonvonhackewitz simonvonhackewitz changed the title lib: improve performance of Mutable_Hash_Map when many succeeding hashes have conflicts lib: improve performance of Mutable_Hash_Map when many succeeding hashes have conflicts Sep 15, 2025
@michaellilltokiwa
Copy link
Copy Markdown
Member

@simonvonhackewitz Did you do some basic benchmarking to validate this?

@simonvonhackewitz
Copy link
Copy Markdown
Collaborator Author

@simonvonhackewitz Did you do some basic benchmarking to validate this?

I've used the example from #5885 and the performance for that specific scenario of insertions to succeeding cells after they have been filled by previous insertions does improve. Inserting n elements is no longer in O(n²).

However, it does not improve performance for collisions in a single cell.

@michaellilltokiwa michaellilltokiwa added performance issue Performance of an operation (time, memory demand, etc.) is not satisfactory and removed cleanup improve code quality labels Sep 15, 2025
@simonvonhackewitz simonvonhackewitz force-pushed the mutable_hash_map_bad_hash_optimization branch from 202fe5a to b9da9f6 Compare November 20, 2025 09:49
@simonvonhackewitz simonvonhackewitz force-pushed the mutable_hash_map_bad_hash_optimization branch from b9da9f6 to e5c442e Compare December 15, 2025 09:06
@simonvonhackewitz simonvonhackewitz force-pushed the mutable_hash_map_bad_hash_optimization branch from e5c442e to 6495bc1 Compare April 13, 2026 13:27
@simonvonhackewitz simonvonhackewitz marked this pull request as ready for review April 13, 2026 13:32
Copy link
Copy Markdown
Member

@michaellilltokiwa michaellilltokiwa left a comment

Choose a reason for hiding this comment

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

It would be good to add a benchmark in /benchmarks covering the most important cases. But does not have to be done in this PR, I would be fine with an enhancement issue.

Comment thread modules/base/src/container/Mutable_Hash_Map.fz
Comment thread modules/base/src/container/Mutable_Hash_Map.fz
@simonvonhackewitz simonvonhackewitz merged commit b85caf7 into tokiwa-software:main Apr 16, 2026
5 checks passed
@simonvonhackewitz simonvonhackewitz deleted the mutable_hash_map_bad_hash_optimization branch April 16, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

modules related to Fuzion modules performance issue Performance of an operation (time, memory demand, etc.) is not satisfactory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants