Skip to content

stdlib: extract the common code of _NativeDictionary.resize and copyAndResize into a separate function #29381

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
Jan 24, 2020

Conversation

eeckstein
Copy link
Contributor

For code size reduction.

@eeckstein
Copy link
Contributor Author

@swift-ci test

@eeckstein eeckstein requested a review from lorentey January 23, 2020 16:14
@eeckstein
Copy link
Contributor Author

@swift-ci benchmark

@swift-ci
Copy link
Contributor

Performance: -O

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeStringHash 67 78 +16.4% 0.86x
StringUTF16Builder 340 370 +8.8% 0.92x (?)
 
Improvement OLD NEW DELTA RATIO
EqualSubstringSubstring 42 39 -7.1% 1.08x (?)
LessSubstringSubstring 42 39 -7.1% 1.08x (?)
EqualSubstringSubstringGenericEquatable 42 39 -7.1% 1.08x (?)
EqualSubstringString 42 39 -7.1% 1.08x (?)
LessSubstringSubstringGenericComparable 42 39 -7.1% 1.08x
EqualStringSubstring 43 40 -7.0% 1.07x (?)

Code size: -O

Improvement OLD NEW DELTA RATIO
Histogram.o 3918 3182 -18.8% 1.23x
DictTest2.o 14333 11757 -18.0% 1.22x
DictionaryCompactMapValues.o 17441 14513 -16.8% 1.20x
DictionarySubscriptDefault.o 24699 20875 -15.5% 1.18x
DictionaryRemove.o 15528 13224 -14.8% 1.17x
DictionaryCopy.o 10454 8982 -14.1% 1.16x
StringRemoveDupes.o 6342 5462 -13.9% 1.16x
DictTest.o 18700 16124 -13.8% 1.16x
TwoSum.o 5160 4456 -13.6% 1.16x
DictTest3.o 20973 18461 -12.0% 1.14x
DictionarySwap.o 20925 18621 -11.0% 1.12x
RGBHistogram.o 24253 21933 -9.6% 1.11x
DictTest4Legacy.o 22756 20612 -9.4% 1.10x
DictionaryOfAnyHashableStrings.o 9071 8239 -9.2% 1.10x
DictTest4.o 21842 19954 -8.6% 1.09x
ReversedCollections.o 9414 8710 -7.5% 1.08x
DictionaryKeysContains.o 9689 8969 -7.4% 1.08x
PrimsNonStrongRef.o 92495 85935 -7.1% 1.08x
Prims.o 13275 12459 -6.1% 1.07x
PrimsSplit.o 13327 12511 -6.1% 1.07x
ReduceInto.o 14810 13930 -5.9% 1.06x
DictionaryGroup.o 14195 13507 -4.8% 1.05x
DictOfArraysToArrayOfDicts.o 20432 19648 -3.8% 1.04x
WordCount.o 39913 39049 -2.2% 1.02x
ObjectiveCBridging.o 61697 60897 -1.3% 1.01x

Performance: -Osize

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeStringHash 67 77 +14.9% 0.87x
ObjectiveCBridgeFromNSSetAnyObjectToString 72500 80000 +10.3% 0.91x (?)
NSStringConversion.MutableCopy.Rebridge 819 896 +9.4% 0.91x (?)
 
Improvement OLD NEW DELTA RATIO
FlattenListFlatMap 7147 5551 -22.3% 1.29x (?)
EqualSubstringSubstring 44 40 -9.1% 1.10x
EqualStringSubstring 44 40 -9.1% 1.10x
EqualSubstringSubstringGenericEquatable 44 40 -9.1% 1.10x
DataAccessBytesMedium 102 94 -7.8% 1.09x
EqualSubstringString 42 39 -7.1% 1.08x (?)
LessSubstringSubstring 43 40 -7.0% 1.07x
LessSubstringSubstringGenericComparable 43 40 -7.0% 1.07x (?)

Code size: -Osize

Regression OLD NEW DELTA RATIO
DictTest2.o 9037 9213 +1.9% 0.98x
DictTest.o 11708 11884 +1.5% 0.99x
DictionaryRemove.o 10656 10816 +1.5% 0.99x
DictTest3.o 13181 13357 +1.3% 0.99x
DictionaryCopy.o 7506 7602 +1.3% 0.99x
DictionarySubscriptDefault.o 15199 15359 +1.1% 0.99x
 
Improvement OLD NEW DELTA RATIO
DictionaryCompactMapValues.o 12743 12119 -4.9% 1.05x

Performance: -Onone

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeStringHash 67 78 +16.4% 0.86x
FloatingPointPrinting_Float80_description_uniform 57400 62200 +8.4% 0.92x (?)
CaptureProp 824890 893670 +8.3% 0.92x (?)
FindString.Rec3.Substring 910 985 +8.2% 0.92x (?)
FindString.Rec3.String 930 1005 +8.1% 0.93x (?)
 
Improvement OLD NEW DELTA RATIO
ObjectiveCBridgeFromNSString 3485 3090 -11.3% 1.13x (?)
SortStringsUnicode 4660 4270 -8.4% 1.09x
LessSubstringSubstringGenericComparable 50 46 -8.0% 1.09x (?)
LessSubstringSubstring 51 47 -7.8% 1.09x (?)
ArrayOfPOD 1121 1036 -7.6% 1.08x (?)

Code size: -swiftlibs

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

Copy link
Member

@lorentey lorentey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

}
}
_storage = result._storage
_copyOrMoveAndResize(capacity: capacity, moveElements: false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the @_semantics attribute here be applied to the new function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good question. I don't think so, because it's an alwaysEmitIntoClient function. Maybe it's better to remove it at all.
I'll experiment a bit.

…ndResize into a separate function

For code size reduction.
@eeckstein
Copy link
Contributor Author

@swift-ci smoke test and merge

1 similar comment
@eeckstein
Copy link
Contributor Author

@swift-ci smoke test and merge

@swift-ci swift-ci merged commit 4555611 into swiftlang:master Jan 24, 2020
@eeckstein eeckstein deleted the dict-change branch January 24, 2020 12:40
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