Skip to content

[stdlib] Force-inline some Sequence/Collection customization points #19683

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 2 commits into from
Oct 3, 2018

Conversation

lorentey
Copy link
Member

@lorentey lorentey commented Oct 3, 2018

This should be a code size win for specialized code at least, but I suspect there may be some performance improvements, too.

…tomization points

This should eliminate a branch, which should probably lead to a tiny overall code size improvement, as well as a tiny performance boost.
…ence/Collection customization points

This is usually a code size pessimization, but in this case the bodies are trivial, so inlining them eliminates a call + a conditional branch.
@lorentey
Copy link
Member Author

lorentey commented Oct 3, 2018

@swift-ci smoke benchmark

@lorentey
Copy link
Member Author

lorentey commented Oct 3, 2018

@swift-ci smoke test

@swift-ci
Copy link
Contributor

swift-ci commented Oct 3, 2018

Build comment file:

Performance: -O

TEST OLD NEW DELTA RATIO
Improvement
DictionaryKeysContainsNative 45 40 -11.1% 1.12x

Code size: -O

TEST OLD NEW DELTA RATIO
Improvement
DictionaryKeysContains.o 18963 17043 -10.1% 1.11x

Performance: -Osize

TEST OLD NEW DELTA RATIO
Regression
UTF8Decode_InitFromBytes_ascii 490 582 +18.8% 0.84x
Improvement
Array2D 13194 11998 -9.1% 1.10x

Code size: -Osize

TEST OLD NEW DELTA RATIO
Improvement
DictionaryKeysContains.o 16859 15003 -11.0% 1.12x
NibbleSort.o 20000 19616 -1.9% 1.02x
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 3, 2018

Results are as expected. Would've loved to see movement beyond Dictionary.Keys, although I guess that is the primary benefactor right now.

@lorentey lorentey merged commit 20bb815 into swiftlang:master Oct 3, 2018
@lorentey lorentey deleted the inline-customization-points branch October 3, 2018 14:43
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.

2 participants