-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
ElementLocation optimisations #10029
Open
drewnoakes
wants to merge
29
commits into
dotnet:main
Choose a base branch
from
drewnoakes:element-location-perf
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Commits on Apr 17, 2024
-
Remove redundant GetHashCode calls
For Int32, GetHashCode just returns the value directly.
Configuration menu - View commit details
-
Copy full SHA for 776ec7a - Browse repository at this point
Copy the full SHA 776ec7aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 37def11 - Browse repository at this point
Copy the full SHA 37def11View commit details -
Configuration menu - View commit details
-
Copy full SHA for cb6ec14 - Browse repository at this point
Copy the full SHA cb6ec14View commit details
Commits on Apr 18, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 093bee7 - Browse repository at this point
Copy the full SHA 093bee7View commit details -
Pack line and column values into four bytes
The SmallElementLocation class exists because very few element locations require 32 bits to store the line/column values. It uses ushort (2 bytes) instead of int (4 bytes) for each value, in an attempt to reduce memory usage. However the CLR aligns ushort fields on classes at four-byte boundaries on most (all?) architectures, meaning the optimisation has no effect. This commit explicitly packs the two values into four bytes to ensure that four bytes is saved per instance.
Configuration menu - View commit details
-
Copy full SHA for 65ed4dd - Browse repository at this point
Copy the full SHA 65ed4ddView commit details -
The caller performs this validation already, and no other code can call this. Avoid some indirection and branching.
Configuration menu - View commit details
-
Copy full SHA for bb30e4f - Browse repository at this point
Copy the full SHA bb30e4fView commit details -
Simplify LocationString construction
The compiler will generate slightly better code from this switch statement, in cases where either line or column is zero.
Configuration menu - View commit details
-
Copy full SHA for 57e0d5b - Browse repository at this point
Copy the full SHA 57e0d5bView commit details -
There was inconsistent handling of validation between implementations. This moves it all into the `Create` method so that it can be handled in one place, consistently.
Configuration menu - View commit details
-
Copy full SHA for 80c1ea2 - Browse repository at this point
Copy the full SHA 80c1ea2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3ea9a86 - Browse repository at this point
Copy the full SHA 3ea9a86View commit details -
Configuration menu - View commit details
-
Copy full SHA for 075ce08 - Browse repository at this point
Copy the full SHA 075ce08View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2f1c078 - Browse repository at this point
Copy the full SHA 2f1c078View commit details -
Configuration menu - View commit details
-
Copy full SHA for 28cfb19 - Browse repository at this point
Copy the full SHA 28cfb19View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2acc628 - Browse repository at this point
Copy the full SHA 2acc628View commit details -
Configuration menu - View commit details
-
Copy full SHA for 596c574 - Browse repository at this point
Copy the full SHA 596c574View commit details -
Configuration menu - View commit details
-
Copy full SHA for d461522 - Browse repository at this point
Copy the full SHA d461522View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5ef2a4b - Browse repository at this point
Copy the full SHA 5ef2a4bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2b81d60 - Browse repository at this point
Copy the full SHA 2b81d60View commit details -
Configuration menu - View commit details
-
Copy full SHA for fc82d47 - Browse repository at this point
Copy the full SHA fc82d47View commit details -
Configuration menu - View commit details
-
Copy full SHA for be277f6 - Browse repository at this point
Copy the full SHA be277f6View commit details -
The CLR does in fact pack these fields adjacent to one another, so we don't have to do this in code ourselves.
Configuration menu - View commit details
-
Copy full SHA for 2653348 - Browse repository at this point
Copy the full SHA 2653348View commit details
Commits on Apr 19, 2024
-
Configuration menu - View commit details
-
Copy full SHA for efb2f9a - Browse repository at this point
Copy the full SHA efb2f9aView commit details
Commits on Apr 22, 2024
-
Pack ElementLocation more efficiently on 64-bit architectures
Adds new subtypes for `ElementLocation` that pack to multiples of eight bytes, to avoid wasting space at runtime on padding between instances of this class in memory. The primary gain here comes from being able to use a smaller value for the `File` value. With this change, there's a lock-free cache of file paths which are then stored by index. When the index is small, as it usually will be, it can be packed for efficiently (e.g. in 2 bytes) than a string reference (8 bytes on 64-bit architectures). See code comment for more details. Also remove file IO from unit tests so they run faster.
Configuration menu - View commit details
-
Copy full SHA for 4d4a4ee - Browse repository at this point
Copy the full SHA 4d4a4eeView commit details -
Configuration menu - View commit details
-
Copy full SHA for e5ab818 - Browse repository at this point
Copy the full SHA e5ab818View commit details -
Configuration menu - View commit details
-
Copy full SHA for c47008b - Browse repository at this point
Copy the full SHA c47008bView commit details -
Configuration menu - View commit details
-
Copy full SHA for be049a8 - Browse repository at this point
Copy the full SHA be049a8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3fb49a8 - Browse repository at this point
Copy the full SHA 3fb49a8View commit details -
Configuration menu - View commit details
-
Copy full SHA for c3de378 - Browse repository at this point
Copy the full SHA c3de378View commit details -
Configuration menu - View commit details
-
Copy full SHA for a3af7bf - Browse repository at this point
Copy the full SHA a3af7bfView commit details -
Configuration menu - View commit details
-
Copy full SHA for eeed871 - Browse repository at this point
Copy the full SHA eeed871View commit details
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.