Shorten type checking times by shortening expressions and avoiding type conversions#5105
Open
idrougge wants to merge 1 commit intoChartsOrg:masterfrom
Open
Shorten type checking times by shortening expressions and avoiding type conversions#5105idrougge wants to merge 1 commit intoChartsOrg:masterfrom
idrougge wants to merge 1 commit intoChartsOrg:masterfrom
Conversation
Contributor
|
Oof. Similar work done in #5124. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I noticed that DGCharts amounted to a large portion of the compile times of our app, so I measured the times for evaluating expressions and function bodies by adding the below build flags:
It turned out that certain functions and expressions had evaluation times close to one second on an M1 Mac, so I added some help for the compiler to shorten those checking times.
As a result of these changes, the compile times have gone down from 6 s for the entire package to only 4 s — a 33 % decrease. Certain files still make out the bulk of the total compile time so a further refactoring of those files could enable higher parallelisation of compilation, but that would make this PR too big to review.
Goals ⚽
Shorter compile times.
Implementation Details 🚧
-0.5 * (sqrt(1.0 - position * position) - 1.0)DoubletoDoublesuch asDouble( sqrt(1 - position * position) )guardto functions that consisted of just one bigifstatementvar maxW: CGFloat = 0.0Testing Details 🔍
The tests still run as before.
To ease code review, it helps to turn on "hide white spaces" in Github's code review view.