-
Notifications
You must be signed in to change notification settings - Fork 212
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
Specialize navigating map[string]interface{} #758
Draft
pelletier
wants to merge
2
commits into
v2
Choose a base branch
from
less-reflect
base: v2
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.
Draft
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
This is a common type. Specializing it to reduce the use of reflection yields better performance. Similar to #669, there is a lot to explore there. name old time/op new time/op delta UnmarshalDataset/config-8 13.3ms ± 0% 12.3ms ± 0% -7.45% (p=0.008 n=5+5) UnmarshalDataset/canada-8 55.7ms ± 0% 55.2ms ± 0% -0.88% (p=0.008 n=5+5) UnmarshalDataset/citm_catalog-8 16.6ms ± 1% 16.5ms ± 1% -0.97% (p=0.008 n=5+5) UnmarshalDataset/twitter-8 7.10ms ± 1% 7.01ms ± 1% -1.28% (p=0.016 n=5+5) UnmarshalDataset/code-8 63.8ms ± 0% 52.0ms ± 0% -18.45% (p=0.008 n=5+5) UnmarshalDataset/example-8 121µs ± 0% 119µs ± 0% -2.13% (p=0.008 n=5+5) Unmarshal/SimpleDocument/struct-8 438ns ± 1% 432ns ± 1% -1.40% (p=0.008 n=5+5) Unmarshal/SimpleDocument/map-8 594ns ± 2% 573ns ± 1% -3.56% (p=0.008 n=5+5) Unmarshal/ReferenceFile/struct-8 34.3µs ± 1% 33.7µs ± 0% -1.95% (p=0.008 n=5+5) Unmarshal/ReferenceFile/map-8 48.6µs ± 0% 44.2µs ± 1% -9.22% (p=0.008 n=5+5) Unmarshal/HugoFrontMatter-8 7.88µs ± 1% 7.28µs ± 1% -7.66% (p=0.008 n=5+5) name old speed new speed delta UnmarshalDataset/config-8 78.9MB/s ± 0% 85.2MB/s ± 0% +8.05% (p=0.008 n=5+5) UnmarshalDataset/canada-8 39.5MB/s ± 0% 39.9MB/s ± 0% +0.89% (p=0.008 n=5+5) UnmarshalDataset/citm_catalog-8 33.6MB/s ± 1% 33.9MB/s ± 1% +0.98% (p=0.008 n=5+5) UnmarshalDataset/twitter-8 62.3MB/s ± 1% 63.1MB/s ± 1% +1.30% (p=0.016 n=5+5) UnmarshalDataset/code-8 42.1MB/s ± 0% 51.6MB/s ± 0% +22.62% (p=0.008 n=5+5) UnmarshalDataset/example-8 66.9MB/s ± 0% 68.3MB/s ± 0% +2.18% (p=0.008 n=5+5) Unmarshal/SimpleDocument/struct-8 25.1MB/s ± 1% 25.4MB/s ± 1% +1.43% (p=0.008 n=5+5) Unmarshal/SimpleDocument/map-8 18.5MB/s ± 2% 19.2MB/s ± 1% +3.70% (p=0.008 n=5+5) Unmarshal/ReferenceFile/struct-8 153MB/s ± 1% 156MB/s ± 0% +1.99% (p=0.008 n=5+5) Unmarshal/ReferenceFile/map-8 108MB/s ± 0% 119MB/s ± 1% +10.16% (p=0.008 n=5+5) Unmarshal/HugoFrontMatter-8 69.3MB/s ± 1% 75.0MB/s ± 1% +8.30% (p=0.008 n=5+5) name old alloc/op new alloc/op delta UnmarshalDataset/config-8 5.86MB ± 0% 5.26MB ± 0% -10.36% (p=0.008 n=5+5) UnmarshalDataset/canada-8 83.0MB ± 0% 83.0MB ± 0% -0.00% (p=0.008 n=5+5) UnmarshalDataset/citm_catalog-8 34.7MB ± 0% 34.7MB ± 0% -0.04% (p=0.008 n=5+5) UnmarshalDataset/twitter-8 12.7MB ± 0% 12.7MB ± 0% ~ (p=0.548 n=5+5) UnmarshalDataset/code-8 22.2MB ± 0% 15.3MB ± 0% -30.76% (p=0.008 n=5+5) UnmarshalDataset/example-8 186kB ± 0% 186kB ± 0% -0.04% (p=0.008 n=5+5) Unmarshal/SimpleDocument/struct-8 805B ± 0% 805B ± 0% ~ (all equal) Unmarshal/SimpleDocument/map-8 1.13kB ± 0% 1.13kB ± 0% ~ (all equal) Unmarshal/ReferenceFile/struct-8 20.9kB ± 0% 20.9kB ± 0% ~ (all equal) Unmarshal/ReferenceFile/map-8 38.2kB ± 0% 36.4kB ± 0% -4.86% (p=0.029 n=4+4) Unmarshal/HugoFrontMatter-8 7.44kB ± 0% 7.20kB ± 0% -3.23% (p=0.008 n=5+5) name old allocs/op new allocs/op delta UnmarshalDataset/config-8 227k ± 0% 189k ± 0% -16.74% (p=0.029 n=4+4) UnmarshalDataset/canada-8 782k ± 0% 782k ± 0% -0.00% (p=0.008 n=5+5) UnmarshalDataset/citm_catalog-8 192k ± 0% 191k ± 0% -0.49% (p=0.000 n=5+4) UnmarshalDataset/twitter-8 56.9k ± 0% 56.9k ± 0% -0.00% (p=0.032 n=5+5) UnmarshalDataset/code-8 1.05M ± 0% 0.63M ± 0% -40.52% (p=0.008 n=5+5) UnmarshalDataset/example-8 1.36k ± 0% 1.36k ± 0% -0.15% (p=0.008 n=5+5) Unmarshal/SimpleDocument/struct-8 9.00 ± 0% 9.00 ± 0% ~ (all equal) Unmarshal/SimpleDocument/map-8 13.0 ± 0% 13.0 ± 0% ~ (all equal) Unmarshal/ReferenceFile/struct-8 183 ± 0% 183 ± 0% ~ (all equal) Unmarshal/ReferenceFile/map-8 642 ± 0% 526 ± 0% -18.07% (p=0.008 n=5+5) Unmarshal/HugoFrontMatter-8 141 ± 0% 126 ± 0% -10.64% (p=0.008 n=5+5)
name old time/op new time/op delta UnmarshalDataset/config-8 12.3ms ± 0% 10.9ms ± 0% -11.36% (p=0.008 n=5+5) UnmarshalDataset/canada-8 55.2ms ± 0% 55.4ms ± 1% ~ (p=0.690 n=5+5) UnmarshalDataset/citm_catalog-8 16.5ms ± 1% 15.7ms ± 0% -4.43% (p=0.008 n=5+5) UnmarshalDataset/twitter-8 7.01ms ± 1% 6.63ms ± 0% -5.34% (p=0.008 n=5+5) UnmarshalDataset/code-8 52.0ms ± 0% 48.7ms ± 2% -6.43% (p=0.008 n=5+5) UnmarshalDataset/example-8 119µs ± 0% 110µs ± 3% -6.81% (p=0.008 n=5+5) Unmarshal/SimpleDocument/struct-8 432ns ± 1% 431ns ± 1% ~ (p=0.222 n=5+5) Unmarshal/SimpleDocument/map-8 573ns ± 1% 540ns ± 1% -5.64% (p=0.008 n=5+5) Unmarshal/ReferenceFile/struct-8 33.7µs ± 0% 33.6µs ± 0% ~ (p=0.310 n=5+5) Unmarshal/ReferenceFile/map-8 44.2µs ± 1% 41.7µs ± 1% -5.63% (p=0.008 n=5+5) Unmarshal/HugoFrontMatter-8 7.28µs ± 1% 6.74µs ± 1% -7.42% (p=0.008 n=5+5) [Geo mean] 292µs 277µs -4.91% name old speed new speed delta UnmarshalDataset/config-8 85.2MB/s ± 0% 96.1MB/s ± 0% +12.82% (p=0.008 n=5+5) UnmarshalDataset/canada-8 39.9MB/s ± 0% 39.8MB/s ± 1% ~ (p=0.690 n=5+5) UnmarshalDataset/citm_catalog-8 33.9MB/s ± 1% 35.5MB/s ± 0% +4.64% (p=0.008 n=5+5) UnmarshalDataset/twitter-8 63.1MB/s ± 1% 66.6MB/s ± 0% +5.65% (p=0.008 n=5+5) UnmarshalDataset/code-8 51.6MB/s ± 0% 55.1MB/s ± 2% +6.88% (p=0.008 n=5+5) UnmarshalDataset/example-8 68.3MB/s ± 0% 73.4MB/s ± 3% +7.34% (p=0.008 n=5+5) Unmarshal/SimpleDocument/struct-8 25.4MB/s ± 1% 25.5MB/s ± 1% ~ (p=0.246 n=5+5) Unmarshal/SimpleDocument/map-8 19.2MB/s ± 1% 20.4MB/s ± 1% +5.99% (p=0.008 n=5+5) Unmarshal/ReferenceFile/struct-8 156MB/s ± 0% 156MB/s ± 0% ~ (p=0.310 n=5+5) Unmarshal/ReferenceFile/map-8 119MB/s ± 1% 126MB/s ± 1% +5.97% (p=0.008 n=5+5) Unmarshal/HugoFrontMatter-8 75.0MB/s ± 1% 81.0MB/s ± 1% +8.01% (p=0.008 n=5+5) [Geo mean] 56.1MB/s 59.0MB/s +5.17% name old alloc/op new alloc/op delta UnmarshalDataset/config-8 5.26MB ± 0% 4.75MB ± 0% -9.66% (p=0.008 n=5+5) UnmarshalDataset/canada-8 83.0MB ± 0% 83.0MB ± 0% -0.00% (p=0.008 n=5+5) UnmarshalDataset/citm_catalog-8 34.7MB ± 0% 34.3MB ± 0% -1.13% (p=0.008 n=5+5) UnmarshalDataset/twitter-8 12.7MB ± 0% 12.5MB ± 0% -1.44% (p=0.008 n=5+5) UnmarshalDataset/code-8 15.3MB ± 0% 13.9MB ± 0% -9.27% (p=0.008 n=5+5) UnmarshalDataset/example-8 186kB ± 0% 182kB ± 0% -2.20% (p=0.008 n=5+5) Unmarshal/SimpleDocument/struct-8 805B ± 0% 805B ± 0% ~ (all equal) Unmarshal/SimpleDocument/map-8 1.13kB ± 0% 1.12kB ± 0% -1.41% (p=0.008 n=5+5) Unmarshal/ReferenceFile/struct-8 20.9kB ± 0% 20.9kB ± 0% ~ (all equal) Unmarshal/ReferenceFile/map-8 36.4kB ± 0% 35.4kB ± 0% ~ (p=0.079 n=4+5) Unmarshal/HugoFrontMatter-8 7.20kB ± 0% 6.98kB ± 0% -3.11% (p=0.008 n=5+5) [Geo mean] 312kB 303kB -2.86% name old allocs/op new allocs/op delta UnmarshalDataset/config-8 189k ± 0% 157k ± 0% -16.80% (p=0.029 n=4+4) UnmarshalDataset/canada-8 782k ± 0% 782k ± 0% -0.00% (p=0.008 n=5+5) UnmarshalDataset/citm_catalog-8 191k ± 0% 167k ± 0% -12.75% (p=0.000 n=4+5) UnmarshalDataset/twitter-8 56.9k ± 0% 45.5k ± 0% -20.02% (p=0.016 n=5+4) UnmarshalDataset/code-8 626k ± 0% 537k ± 0% -14.22% (p=0.008 n=5+5) UnmarshalDataset/example-8 1.36k ± 0% 1.11k ± 0% -18.53% (p=0.008 n=5+5) Unmarshal/SimpleDocument/struct-8 9.00 ± 0% 9.00 ± 0% ~ (all equal) Unmarshal/SimpleDocument/map-8 13.0 ± 0% 12.0 ± 0% -7.69% (p=0.008 n=5+5) Unmarshal/ReferenceFile/struct-8 183 ± 0% 183 ± 0% ~ (all equal) Unmarshal/ReferenceFile/map-8 526 ± 0% 466 ± 0% -11.41% (p=0.008 n=5+5) Unmarshal/HugoFrontMatter-8 126 ± 0% 112 ± 0% -11.11% (p=0.008 n=5+5) [Geo mean] 3.73k 3.34k -10.51%
pelletier
added
the
performance
Issue related to a performance problem or pull request improving performance.
label
Apr 15, 2022
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.
This is a common type. Specializing it to reduce the use of reflection yields better performance.
Similar to #669, there is a lot to explore there.
The overall structure of unmarshal.go will need to change to make this reasonable in terms of maintenance. But given the results it's probably worth it overall.