Skip to content

Implement init?<T:BinaryInteger>(exactly:T) for the stdlib FP types #32632

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
Jul 1, 2020

Conversation

stephentyrone
Copy link
Contributor

Previously these always went through the FloatingPoint-provided default implementation, which is not particularly efficient. Also try removing inlinable from the generic _convert hooks, since we probably never want to actually inline them (rdar://problem/64544503).

Follow-up on #32617

…h stdlib FP type.

Previously these always went through the FloatingPoint-provided default implementation, which is not particularly efficient. Also try removing inlinable from the generic _convert hooks, since we probably never want to actually inline them.
@stephentyrone
Copy link
Contributor Author

Not able to test this locally at present, so we have to cross our fingers.

@stephentyrone
Copy link
Contributor Author

@swift-ci please test

@stephentyrone stephentyrone requested a review from tbkka June 30, 2020 22:21
@stephentyrone
Copy link
Contributor Author

@swift-ci please benchmark

@swift-ci
Copy link
Contributor

Performance: -O

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeStubToNSDate2 540 610 +13.0% 0.89x (?)
ObjectiveCBridgeStubToNSDateRef 3460 3900 +12.7% 0.89x (?)
StringComparison_nonBMPSlowestPrenormal 1540 1680 +9.1% 0.92x
Array2D 6688 7216 +7.9% 0.93x (?)
 
Improvement OLD NEW DELTA RATIO
ParseFloat.Float.Exp 14 13 -7.1% 1.08x (?)
RandomTree.insert.Unmanaged.fast 211 196 -7.1% 1.08x (?)

Code size: -O

Performance: -Osize

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeStubToNSDateRef 3500 4020 +14.9% 0.87x (?)
UTF8Decode_InitFromData_ascii_as_ascii 628 712 +13.4% 0.88x (?)
Array2D 6928 7520 +8.5% 0.92x
StringComparison_nonBMPSlowestPrenormal 1560 1690 +8.3% 0.92x
StringComparison_emoji 836 900 +7.7% 0.93x (?)
 
Improvement OLD NEW DELTA RATIO
FlattenListFlatMap 6820 5973 -12.4% 1.14x (?)
DataAccessBytesMedium 102 94 -7.8% 1.09x (?)
RandomTree.insert.Unmanaged.fast 211 197 -6.6% 1.07x (?)

Code size: -Osize

Performance: -Onone

Regression OLD NEW DELTA RATIO
FrequenciesUsingReduceInto 4010 4340 +8.2% 0.92x (?)
ArrayOfPOD 1031 1113 +8.0% 0.93x (?)
 
Improvement OLD NEW DELTA RATIO
ObjectiveCBridgeStubFromNSDate 6840 5950 -13.0% 1.15x (?)

Code size: -swiftlibs

Improvement OLD NEW DELTA RATIO
libswiftCoreGraphics.dylib 65536 57344 -12.5% 1.14x
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 7985896 into swiftlang:master Jul 1, 2020
@stephentyrone stephentyrone deleted the rdar-64544503-2 branch July 1, 2020 00:59
stephentyrone added a commit to stephentyrone/swift that referenced this pull request Jul 1, 2020
…h stdlib FP type. (swiftlang#32632)

Previously these always went through the FloatingPoint-provided default implementation, which is not particularly efficient. Also try removing inlinable from the generic _convert hooks, since we probably never want to actually inline them.
airspeedswift pushed a commit that referenced this pull request Jul 2, 2020
* Provide an implementation of init?<T:BinaryInteger>(exactly:T) on each stdlib FP type. (#32632)

Previously these always went through the FloatingPoint-provided default implementation, which is not particularly efficient. Also try removing inlinable from the generic _convert hooks, since we probably never want to actually inline them.

* Add explicit init from BinaryInteger to CGFloat

The override was previously missing, which meant that we fell back on the generic implementation; we should simply forward this to the NativeType implementation instead.
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