-
Notifications
You must be signed in to change notification settings - Fork 97
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
Memoise module paths #799
Memoise module paths #799
Conversation
This also fixes a problem with verifying lookups that caused this test to blow the stack.
The idea here is to ensure maximal sharing, so paths that contain a lot of repetitive paths remain small in absolute memory usage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be a global memo ? There's a lot of empty ()
so potentially a lot of memos that aren't shared.
match Tools.resolve_type_path env cp with | ||
| Ok p' -> `Resolved (Cpath.resolved_type_path_of_cpath p') | ||
| Ok p' -> `Resolved Lang_of.(Path.resolved_type (empty ()) p') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had two ways to convert from Cpath.*
to Path.*
- I deleted the ones in Cpath
and added the memoisation to the other (in Lang_of
).
I considered a global memo, but it's all quite contextual - so converting from the same |
In case it wasn't very obvious from the diff, this can make a startling difference (in the pathological case the test case is testing) - the size of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome !
CHANGES: Additions - New subcommand to resolve references (@panglesd, @lubega-simon, ocaml/odoc#812) - Improved rendering of long signatures (@panglesd, ocaml/odoc#782) - Handle comments attached to open statement as floating comment, instead of dropping them (@panglesd, ocaml/odoc#797) - Empty includes (containing entirely shadowed entries) are now hidden (@panglesd, ocaml/odoc#798) Bugs fixed - Fix a missing Result constructor during compile. This will cause some functor arguments to have different filenames (@jonludlam, ocaml/odoc#795) - Better memory/disk space usage when handling module alias chains (@jonludlam, ocaml/odoc#799) - Resolving class-type paths (ie., `val x : #c`) (@jonludlam, ocaml/odoc#809) - Skip top-level attributes while extracting the top comment. Fix top-comment extraction with PPX preprocessing (@jorisgio, ocaml/odoc#819) - Better handling of @canonical tags (@jonludlam, ocaml/odoc#820) - css: improved layout (@jonludlam, @Julow, ocaml/odoc#822)
The aim here is to reduce the amount of memory used when compiling long chains of aliases, which currently causes problems.