Skip to content

Fix RangeIteration and StringWalk benchmarks' use of globals #27099

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
Sep 11, 2019
Merged

Fix RangeIteration and StringWalk benchmarks' use of globals #27099

merged 2 commits into from
Sep 11, 2019

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Sep 10, 2019

StringWalk benchmark: remove global variable access from the loop.

Global variables are being used as if they are "free black
holes". They might be even more expensive than actually calling
blackHole. But the right thing to do is use local variables and pass
them into a black hole at the end of computation.

RangeIteration benchmark: remove global variable access from the critical path.

This benchmark was "accidentally" accessing a global variable in the
main iteration loop, which is in some situations very expensive and
has nothing to do with what the benchmark is trying to test.

…ical path.

This benchmark was "accidentally" accessing a global variable in the
main iteration loop, which is in some situations very expensive and
has nothing to do with what the benchmark is trying to test.
@atrick atrick requested review from milseman and lorentey September 10, 2019 02:40
@atrick
Copy link
Contributor Author

atrick commented Sep 10, 2019

@swift-ci benchmark

@atrick
Copy link
Contributor Author

atrick commented Sep 10, 2019

@swift-ci smoke test

@swift-ci
Copy link
Contributor

Performance: -O

Regression OLD NEW DELTA RATIO
RangeIterationSigned 87 108 +24.1% 0.81x (?)
 
Improvement OLD NEW DELTA RATIO
FlattenListFlatMap 5587 4206 -24.7% 1.33x (?)

Code size: -O

Improvement OLD NEW DELTA RATIO
RangeIteration.o 1748 1684 -3.7% 1.04x

Performance: -Osize

Regression OLD NEW DELTA RATIO
RangeIterationSigned 87 108 +24.1% 0.81x

Code size: -Osize

Improvement OLD NEW DELTA RATIO
RangeIteration.o 1738 1674 -3.7% 1.04x

Performance: -Onone

Improvement OLD NEW DELTA RATIO
RangeIterationSigned 9913 8177 -17.5% 1.21x

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 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
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.

Interesting; this was a weird pattern.

@atrick
Copy link
Contributor Author

atrick commented Sep 11, 2019

@swift-ci smoke test

Copy link
Member

@milseman milseman left a comment

Choose a reason for hiding this comment

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

LGTM

@atrick
Copy link
Contributor Author

atrick commented Sep 11, 2019

@swift-ci smoke test

Global variables are being used as if they are "free black
holes". They might be even more expensive than actually calling
blackHole. But the right thing to do is use local variables and pass
them into a black hole at the end of computation.
@atrick
Copy link
Contributor Author

atrick commented Sep 11, 2019

@swift-ci smoke test

@atrick atrick merged commit 086eb07 into swiftlang:master Sep 11, 2019
@atrick atrick deleted the fix-rangeiter-bench branch September 13, 2019 16:10
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.

4 participants