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

Reduce allocations using unique identifiers of keys as keys in the map #7

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

Conversation

Armael
Copy link

@Armael Armael commented Jun 2, 2023

Following the recent inclusion in the stdlib (as part of the new Type module) of Type.Id.uid, it looks like we can always compute a unique integer for type ids.
This PR proposes to use this function to: 1) avoid computing uids separately and storing them along type ids; 2) index the underlying map with uids instead of indexing it using keys (that then need to be boxed).
I think this should avoid the allocations mentioned in issue #2, although using a different approach than what is suggested there?

@dbuenzli
Copy link
Owner

dbuenzli commented Jun 2, 2023

Why not. Did you just check if the curent lower bound on OCaml needs updating (4.02) ?

@Armael
Copy link
Author

Armael commented Jun 2, 2023

Ah, I had not. It looks like the Obj.Extension_constructor module was added in 4.08, so I guess we would now require OCaml >= 4.08.

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.

2 participants