Skip to content

perf(memo): flatten parallel dependencies into arrays - #15684

Open
rgrinberg wants to merge 1 commit into
ocaml:mainfrom
rgrinberg:push-mxrzyuozqqlz
Open

perf(memo): flatten parallel dependencies into arrays#15684
rgrinberg wants to merge 1 commit into
ocaml:mainfrom
rgrinberg:push-mxrzyuozqqlz

Conversation

@rgrinberg

Copy link
Copy Markdown
Member

Flattening parallel dependency sections previously converted nested arrays to
lists, repeatedly appended those lists, and then copied the result back into an
array.

Evaluate each thread section once, count its flattened elements, and copy them
directly into one final array. This reduced minor allocation by about 2.0M
words (15 MiB) in both cold and no-op Dune self-builds.

@Alizter

Alizter commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

The bench seems to indicate minor words and collections actually increased rather than decreased.

Flattening parallel dependency sections previously converted nested arrays to
lists, repeatedly appended those lists, and then copied the result back into an
array.

Evaluate each thread section once, count its flattened elements, and copy them
directly into one final array. This reduced minor allocation by about 2.0M
words (15 MiB) in both cold and no-op self-builds.

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants