🌍 #349 Performance improvements#350
Merged
Merged
Conversation
…formance by 5-10% over 100 iterations We're now caching the reflection step. Before: ``` | Method | iterations | Mean | Error | StdDev | Median | |------------------------- |----------- |-----------:|----------:|-----------:|-----------:| | SampleClassWith10Members | 1 | 1.109 ms | 0.0431 ms | 0.1258 ms | 1.070 ms | | SampleClassWith10Members | 10 | 9.865 ms | 0.8243 ms | 2.4304 ms | 10.143 ms | | SampleClassWith10Members | 100 | 101.228 ms | 4.0065 ms | 11.6237 ms | 102.502 ms | ``` After: ``` | Method | iterations | Mean | Error | StdDev | Median | |------------------------- |----------- |----------:|----------:|----------:|----------:| | SampleClassWith10Members | 1 | 1.135 ms | 0.0461 ms | 0.1331 ms | 1.093 ms | | SampleClassWith10Members | 10 | 9.623 ms | 0.7033 ms | 2.0738 ms | 9.959 ms | | SampleClassWith10Members | 100 | 95.180 ms | 1.8817 ms | 3.3930 ms | 94.996 ms | ```
… enumerable Approximately a 15% performance gain in the benchmark. Before: ``` | Method | iterations | Mean | Error | StdDev | Median | |------------------------- |----------- |----------:|----------:|----------:|----------:| | SampleClassWith10Members | 1 | 1.304 ms | 0.0454 ms | 0.1324 ms | 1.261 ms | | SampleClassWith10Members | 10 | 9.729 ms | 0.7487 ms | 2.2074 ms | 9.826 ms | | SampleClassWith10Members | 100 | 93.578 ms | 1.8245 ms | 3.1955 ms | 93.648 ms | ``` After: ``` | Method | iterations | Mean | Error | StdDev | Median | |------------------------- |----------- |------------:|------------:|-----------:|------------:| | SampleClassWith10Members | 1 | 917.7 us | 34.92 us | 100.8 us | 890.5 us | | SampleClassWith10Members | 10 | 6,217.9 us | 544.52 us | 1,605.5 us | 6,246.1 us | | SampleClassWith10Members | 100 | 81,832.7 us | 1,634.06 us | 4,039.0 us | 83,021.4 us | ```
About a 400% increase in performance over the benchmark. Proves that we're spending a lot of time creating gens. Most of the primitive gens inherit from GenProvider, so they'll benefit from this performance improvement. Before: ``` | Method | iterations | Mean | Error | StdDev | Median | |------------------------- |----------- |------------:|------------:|------------:|------------:| | SampleClassWith10Members | 1 | 943.4 us | 33.52 us | 98.83 us | 911.2 us | | SampleClassWith10Members | 10 | 6,001.7 us | 514.95 us | 1,518.33 us | 5,698.9 us | | SampleClassWith10Members | 100 | 82,233.5 us | 1,631.82 us | 4,241.32 us | 83,829.4 us | ``` After: ``` | Method | iterations | Mean | Error | StdDev | Median | |------------------------- |----------- |------------:|----------:|----------:|------------:| | SampleClassWith10Members | 1 | 959.2 us | 29.59 us | 86.77 us | 924.7 us | | SampleClassWith10Members | 10 | 3,112.6 us | 108.18 us | 315.56 us | 3,066.1 us | | SampleClassWith10Members | 100 | 22,662.2 us | 448.86 us | 926.97 us | 22,578.3 us | ```
nth-commit
marked this pull request as ready for review
August 4, 2022 20:28
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.
Lots of code added that prevents reanalyzing reflection, or recreating gens.
Before:
After: