Skip to content

perf(memo): flatten sequential dependencies into arrays - #15683

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

perf(memo): flatten sequential dependencies into arrays#15683
rgrinberg wants to merge 1 commit into
ocaml:mainfrom
rgrinberg:push-smnpvpyrnpmu

Conversation

@rgrinberg

Copy link
Copy Markdown
Member

Dynamic dependency sections are stored in reverse chronological order. Turning
them into a static sequence previously reversed the outer list, converted
nested arrays to lists, concatenated those lists, and finally copied the result
into an array.

Count the flattened elements, allocate the final array once, and fill it from
the end while blitting nested sequences. This reduced minor allocation by about
6.98M words (53 MiB) in both cold and no-op Dune self-builds.

Dynamic dependency sections are stored in reverse chronological order. Turning
them into a static sequence previously reversed the outer list, converted
nested arrays to lists, concatenated those lists, and finally copied the result
into an array.

Count the flattened elements, allocate the final array once, and fill it from
the end while blitting nested sequences. This reduced minor allocation by about
6.98M words (53 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.

1 participant