This repository has been archived by the owner on Jan 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 97
Performance improvements for GetSpanInfo #681
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pepeiborra
force-pushed
the
perf-spaninfo
branch
8 times, most recently
from
July 4, 2020 14:29
e4d0f03
to
267fec4
Compare
cocreature
approved these changes
Jul 13, 2020
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.
Nice thank you!
We’re lagging behind a bit in DAML so it will be a while until I can test it. If it fails, we can always add the CPP back.
Looks like this needs rebasing. |
getSpanInfo was naively calling getDocumentations multiple times on the same name. Fixed by deduplicating these calls. getDocumentations is implemented on top of InteractiveEval.getDocs, which does a lot of Ghc setup internally and is very inefficient. Fixed by introducing a batch version of getDocs and batching all the calls in getSpanInfo name | success | samples | startup | setup | experiment | maxResidency ------------- | ------- | ------- | ------- | ----- | ---------- | ------------ edit (before) | True | 10 | 6.94s | 0.00s | 6.57s | 177MB edit (after) | True | 10 | 6.44s | 0.00s | 4.38s | 174MB
Played the deduplication trick on lookupName, which is slow for the same reasons as getDocs. Batching made a smaller difference in my measurements, so did not implement it
We don't use the interactive module, so there's no reason to go through the GHCi code paths. Moreover, they apparently cause problems with ghc-lib.
pepeiborra
force-pushed
the
perf-spaninfo
branch
from
July 13, 2020 13:59
267fec4
to
2748740
Compare
Rebased. I'd rather put back the CPP exclusions, merge this now, and then send a separate PR to remove them which can be tested in due time. Might be able to do this later today |
Thanks! I'll submit a PR to restore the CPP sections later today or tomorrow. |
pepeiborra
added a commit
to pepeiborra/ide
that referenced
this pull request
Dec 29, 2020
* Performance improvements getSpanInfo was naively calling getDocumentations multiple times on the same name. Fixed by deduplicating these calls. getDocumentations is implemented on top of InteractiveEval.getDocs, which does a lot of Ghc setup internally and is very inefficient. Fixed by introducing a batch version of getDocs and batching all the calls in getSpanInfo name | success | samples | startup | setup | experiment | maxResidency ------------- | ------- | ------- | ------- | ----- | ---------- | ------------ edit (before) | True | 10 | 6.94s | 0.00s | 6.57s | 177MB edit (after) | True | 10 | 6.44s | 0.00s | 4.38s | 174MB * More performance improvements Played the deduplication trick on lookupName, which is slow for the same reasons as getDocs. Batching made a smaller difference in my measurements, so did not implement it * Fix redundant constraints * Skip the GHCi code paths for documentation We don't use the interactive module, so there's no reason to go through the GHCi code paths. Moreover, they apparently cause problems with ghc-lib. * Skip the GHCi paths for lookupName * Correctly load the module interface * Compatibility with GHC 8.4 and 8.6 * Fix ghc-lib build
pepeiborra
added a commit
to pepeiborra/ide
that referenced
this pull request
Dec 29, 2020
* Performance improvements getSpanInfo was naively calling getDocumentations multiple times on the same name. Fixed by deduplicating these calls. getDocumentations is implemented on top of InteractiveEval.getDocs, which does a lot of Ghc setup internally and is very inefficient. Fixed by introducing a batch version of getDocs and batching all the calls in getSpanInfo name | success | samples | startup | setup | experiment | maxResidency ------------- | ------- | ------- | ------- | ----- | ---------- | ------------ edit (before) | True | 10 | 6.94s | 0.00s | 6.57s | 177MB edit (after) | True | 10 | 6.44s | 0.00s | 4.38s | 174MB * More performance improvements Played the deduplication trick on lookupName, which is slow for the same reasons as getDocs. Batching made a smaller difference in my measurements, so did not implement it * Fix redundant constraints * Skip the GHCi code paths for documentation We don't use the interactive module, so there's no reason to go through the GHCi code paths. Moreover, they apparently cause problems with ghc-lib. * Skip the GHCi paths for lookupName * Correctly load the module interface * Compatibility with GHC 8.4 and 8.6 * Fix ghc-lib build
pepeiborra
added a commit
to pepeiborra/ide
that referenced
this pull request
Dec 29, 2020
* Performance improvements getSpanInfo was naively calling getDocumentations multiple times on the same name. Fixed by deduplicating these calls. getDocumentations is implemented on top of InteractiveEval.getDocs, which does a lot of Ghc setup internally and is very inefficient. Fixed by introducing a batch version of getDocs and batching all the calls in getSpanInfo name | success | samples | startup | setup | experiment | maxResidency ------------- | ------- | ------- | ------- | ----- | ---------- | ------------ edit (before) | True | 10 | 6.94s | 0.00s | 6.57s | 177MB edit (after) | True | 10 | 6.44s | 0.00s | 4.38s | 174MB * More performance improvements Played the deduplication trick on lookupName, which is slow for the same reasons as getDocs. Batching made a smaller difference in my measurements, so did not implement it * Fix redundant constraints * Skip the GHCi code paths for documentation We don't use the interactive module, so there's no reason to go through the GHCi code paths. Moreover, they apparently cause problems with ghc-lib. * Skip the GHCi paths for lookupName * Correctly load the module interface * Compatibility with GHC 8.4 and 8.6 * Fix ghc-lib build
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Avoiding duplicate work and batching ghc-api lookups for both
getDocs
andlookupName
are the main sources of improvement.As a bonus I also removed usage of the GHCi code paths. Since there is no way for me to test if this fixes the ghc-lib issues, I'm happy to put the CPP pragmas back if that's preferred.
Full benchmarks in: https://github.com/pepeiborra/ghcide/tree/perf-spaninfo-benchmark