Skip to content

Make basicUnsafeIndexM strict in element for Storable - #576

Merged
Shimuuar merged 2 commits into
masterfrom
indexing-storable
Nov 2, 2026
Merged

Shimuuar merged 2 commits into
masterfrom
indexing-storable

Conversation

@Shimuuar

Copy link
Copy Markdown
Contributor

I think it does make sense to make indexing strict. There's no unevaluated thunk which we may want to preserve, we create new value in place. Similarly primitive vectors forces result of indexing. Judging from bug report GHC <9.12 was able to optimize overhead away. So we seems to be at edge of its ability. No point in making its work harder.

This PR also adds regression test for checking that index doesn't allocate with -O2 (sadly it does with -O1)

Fixes #570

@Shimuuar
Shimuuar merged commit 313568c into master Nov 2, 2026
26 checks passed
@Shimuuar
Shimuuar deleted the indexing-storable branch November 2, 2026 07:49
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.

Storable basicUnsafeIndexM does not force the element read, so == and compare allocate 56 bytes an element

1 participant