-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Improve memory characteristics of ExportsMap #3231
Conversation
da753af
to
795dfa5
Compare
mText = pack $ moduleNameString mn | ||
fmap (wrap . unwrap mText) <$> withHieDb (\hieDb -> getExportsForModule hieDb mn) | ||
let exportsMap = Map.fromListWith (<>) (concat idents) | ||
return $ ExportsMap exportsMap $ buildModuleExportMap (concat idents) |
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.
This fixes a bug where the module exports map created from hiedb would be keyed by the identifier name instead of the module name. Caught because of using proper types instead of Text!
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.
This looks good to me, but could you share some benchmarks showing the improvement?
6a6493c
to
a4fe2bf
Compare
e5cb905
to
c13ef89
Compare
4044636
to
7e64746
Compare
c9c3181
to
b7896be
Compare
b7896be
to
4ca97e2
Compare
Storing rendered names as `Text`, especially for parents, adds a lot of duplication to the ExportsMap. Instead we store the `OccName`s directly, which have hash-consed symbols due stored as `FastStrings` and render it out on demand (which is just decoding the UTF-8 FastString to UTF-16 text for text <2.0, and essentially free on text >2.0).
4ca97e2
to
996c62a
Compare
996c62a
to
7a4e1a9
Compare
Storing rendered names as
Text
, especially for parents, adds a lot of duplication to the ExportsMap.Instead we store the
OccName
s directly, which have hash-consed symbols due stored asFastStrings
and render it out on demand (which is just decoding the UTF-8 FastString to UTF-16 text for text <2.0,
and essentially free on text >2.0).
This PR depends on #3204, ignore that commit while reviewing.