Skip to content

Remove concrete inits from integer types #19624

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 4 commits into from
Sep 30, 2018

Conversation

stephentyrone
Copy link
Contributor

@stephentyrone stephentyrone commented Sep 29, 2018

We should no longer need these with the protocol-based integer support we now have. Some small work may be needed to fix performance regressions, but that will come in a follow-on update.

I did have to keep the concrete init from Int around to keep the type checker from failing in some new cases; I hope we can remove that too in the future.

Fixes rdar://problem/33199966

@stephentyrone
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - ebfd97a

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - ebfd97a

Rework Self._convert from integer, by making it require RawSignificand: FixedWidthInteger
This requirement should have always been there, and the existing implementaiton wouldn't
have actually worked correctly without it. Making it explcit makes the implementation quite
a bit simpler, which is nice.

Add fast-path conversion that will catch all concrete integer types without needing to be
a concrete implementation itself. Room for further improvement, but good start.
@stephentyrone
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - ebfd97a

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - ebfd97a

@stephentyrone
Copy link
Contributor Author

@swift-ci please test

@stephentyrone
Copy link
Contributor Author

@swift-ci please benchmark

@stephentyrone
Copy link
Contributor Author

@swift-ci please test source compatibility

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 05ccbba

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 05ccbba

@swift-ci
Copy link
Contributor

Build comment file:

Performance: -O

TEST OLD NEW DELTA RATIO
Improvement
RandomDoubleLCG 2143 915 -57.3% 2.34x
IterateData 1707 1570 -8.0% 1.09x (?)

Code size: -O

TEST OLD NEW DELTA RATIO
Improvement
RandomValues.o 4631 4135 -10.7% 1.12x

Performance: -Osize

TEST OLD NEW DELTA RATIO
Regression
CStringLongAscii 3291 3548 +7.8% 0.93x
Improvement
RandomDoubleLCG 2586 971 -62.5% 2.66x
IterateData 1839 1642 -10.7% 1.12x (?)

Code size: -Osize

TEST OLD NEW DELTA RATIO
Improvement
RandomValues.o 4132 3620 -12.4% 1.14x

Performance: -Onone

TEST OLD NEW DELTA RATIO
Improvement
RandomDoubleLCG 59073 50168 -15.1% 1.18x
ArrayOfPOD 846 758 -10.4% 1.12x (?)
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

@stephentyrone stephentyrone merged commit 0707ca6 into swiftlang:master Sep 30, 2018
@stephentyrone stephentyrone deleted the pr-33199966 branch September 30, 2018 15:57
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