Skip to content

[stdlib] Force-inline Dictionary.subscript(_:, default:)._modify #19663

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

Merged
merged 1 commit into from
Oct 2, 2018

Conversation

lorentey
Copy link
Member

@lorentey lorentey commented Oct 2, 2018

Otherwise the autoclosure argument gets allocated on the heap, which leads to a 2x slowdown.

rdar://problem/44936389

Otherwise the autoclosure argument gets allocated on the heap, which leads to a 2x slowdown.
@lorentey
Copy link
Member Author

lorentey commented Oct 2, 2018

@swift-ci please smoke benchmark

@lorentey
Copy link
Member Author

lorentey commented Oct 2, 2018

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Oct 2, 2018

Build comment file:

Performance: -O

TEST OLD NEW DELTA RATIO
Improvement
DictionarySubscriptDefaultMutationOfObjects 2958 1665 -43.7% 1.78x
DictionarySubscriptDefaultMutation 561 354 -36.9% 1.58x
FrequenciesUsingReduceInto 1904 1204 -36.8% 1.58x
DictionarySubscriptDefaultMutationArrayOfObjects 5477 4119 -24.8% 1.33x

Code size: -O

TEST OLD NEW DELTA RATIO
Regression
ReduceInto.o 22984 24783 +7.8% 0.93x
Improvement
DictionarySubscriptDefault.o 33820 32891 -2.7% 1.03x

Performance: -Osize

TEST OLD NEW DELTA RATIO
Improvement
DictionarySubscriptDefaultMutationOfObjects 3205 1799 -43.9% 1.78x
FrequenciesUsingReduceInto 2200 1446 -34.3% 1.52x
DictionarySubscriptDefaultMutation 722 491 -32.0% 1.47x
DictionarySubscriptDefaultMutationArrayOfObjects 5523 4281 -22.5% 1.29x

Code size: -Osize

TEST OLD NEW DELTA RATIO
Regression
ReduceInto.o 15400 16938 +10.0% 0.91x
Improvement
DictionarySubscriptDefault.o 28884 27939 -3.3% 1.03x

Performance: -Onone

TEST OLD NEW DELTA RATIO
Improvement
MapReduceLazyCollection 30877 22312 -27.7% 1.38x
MapReduceLazyCollectionShort 43489 35069 -19.4% 1.24x
How to read the data The tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.

If you see any unexpected regressions, you should consider fixing the regressions before you merge the PR.

Noise: Sometimes the performance results (not code size!) contain false alarms. Unexpected regressions which are marked with '(?)' are probably noise. If you see regressions which you cannot explain you can try to run the benchmarks again. If regressions still show up, please consult with the performance team (@eeckstein).

Hardware Overview
  Model Name: Mac Pro
  Model Identifier: MacPro6,1
  Processor Name: 12-Core Intel Xeon E5
  Processor Speed: 2.7 GHz
  Number of Processors: 1
  Total Number of Cores: 12
  L2 Cache (per Core): 256 KB
  L3 Cache: 30 MB
  Memory: 64 GB

@lorentey
Copy link
Member Author

lorentey commented Oct 2, 2018

cc @airspeedswift

@lorentey lorentey merged commit 4887fcf into swiftlang:master Oct 2, 2018
@lorentey lorentey deleted the default-subscript-is-slow branch October 2, 2018 16:10
@jrose-apple
Copy link
Contributor

We really need to get non-heap-allocated non-escaping closures…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants