Skip to content

[Constant Evaluator] Move "string.append" semantics attribute from String.+= function to String.append function. #24397

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

Conversation

ravikandhadai
Copy link
Contributor

String.+= is given a new semantics attribute "string.plusequals".

Teach the constant evaluator about String.append instead of String.+=.

With this change, String.append is the primitive whose semantics is built into the constant evaluator. This makes the evaluator a bit more general as String.append is also used by String.+ (string concatenation).

`String.+=` function to `String.append` function, and use a new
semantics attribute for String.+=.

Teach the constant evaluator about `String.Append` instead of `String.+=`.
@ravikandhadai
Copy link
Contributor Author

@swift-ci Please smoke test

@eeckstein
Copy link
Contributor

@swift-ci benchmark

@swift-ci
Copy link
Contributor

Performance: -O

TEST OLD NEW DELTA RATIO
Improvement
StringBuilderWithLongSubstring 1010 930 -7.9% 1.09x (?)

Performance: -Osize

TEST OLD NEW DELTA RATIO
Improvement
DataAppendDataLargeToLarge 24000 17400 -27.5% 1.38x (?)
PrefixCountableRange 15 14 -6.7% 1.07x (?)
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 mini
  Model Identifier: Macmini8,1
  Processor Name: Intel Core i7
  Processor Speed: 3.2 GHz
  Number of Processors: 1
  Total Number of Cores: 6
  L2 Cache (per Core): 256 KB
  L3 Cache: 12 MB
  Memory: 64 GB

@ravikandhadai
Copy link
Contributor Author

@swift-ci benchmark

@swift-ci
Copy link
Contributor

Performance: -O

TEST OLD NEW DELTA RATIO
Regression
SortLettersInPlace 385 416 +8.1% 0.93x (?)

Performance: -Osize

TEST OLD NEW DELTA RATIO
Regression
PrefixCountableRangeLazy 15 17 +13.3% 0.88x (?)
MapReduceShortString 12 13 +8.3% 0.92x (?)
Improvement
StringBuilderLong 920 840 -8.7% 1.10x (?)
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 mini
  Model Identifier: Macmini8,1
  Processor Name: Intel Core i7
  Processor Speed: 3.2 GHz
  Number of Processors: 1
  Total Number of Cores: 6
  L2 Cache (per Core): 256 KB
  L3 Cache: 12 MB
  Memory: 64 GB

@ravikandhadai
Copy link
Contributor Author

Doesn't look like the regressing benchmarks are using String append (except for StringBuilderLong). I think this is just noise, considering the last two results.

@ravikandhadai
Copy link
Contributor Author

@swift-ci benchmark

@swift-ci
Copy link
Contributor

swift-ci commented May 1, 2019

Performance: -Osize

TEST OLD NEW DELTA RATIO
Regression
DropFirstCountableRangeLazy 13 14 +7.7% 0.93x (?)

Performance: -Onone

TEST OLD NEW DELTA RATIO
Regression
SubstringFromLongString 9 10 +11.1% 0.90x (?)
Improvement
ObjectiveCBridgeStubFromNSDate 3320 2910 -12.3% 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 mini
  Model Identifier: Macmini8,1
  Processor Name: Intel Core i7
  Processor Speed: 3.2 GHz
  Number of Processors: 1
  Total Number of Cores: 6
  L2 Cache (per Core): 256 KB
  L3 Cache: 12 MB
  Memory: 64 GB

Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

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

lgtm

@ravikandhadai
Copy link
Contributor Author

@swift-ci Please test and merge

@swift-ci swift-ci merged commit 0d955da into swiftlang:master May 1, 2019
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