Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not memoize free variables #2886

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Do not memoize free variables #2886

wants to merge 2 commits into from

Conversation

mtzguido
Copy link
Member

A look at a memory profile suggested that Syntax.mk was allocating much of the memory to. One particular overhead it has is creating a fresh memo reference for the free variables of the term, which are memoized at every node. This change removes that memoization, which does result in less memory being used. It also seems to be faster, see the graphs below:

compact_time
compact_mem

This graph was obtained by setting OCaml's Gc.max_overhead to zero to trigger frequent heap compactions. With this setting it's not clear that the speed improvement would carry over to a normal setting, as less allocations means less GC and therefore a lot less compactions, which are expensive. But I re-ran the test without that setting, and it seems similar:

nocompact_time
nocompact_mem

@mtzguido mtzguido marked this pull request as draft April 24, 2023 14:34
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.

None yet

1 participant