Skip to content

[QoI][stdlib] Improve some random call sites #20320

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 3 commits into from
Nov 9, 2018

Conversation

Azoy
Copy link
Contributor

@Azoy Azoy commented Nov 5, 2018

Instead of using generator directly, use Int.random(in:) to improve clarity of these call sites.

cc: @lorentey

Can you also kick off benchmarks as well?

@harlanhaskins
Copy link
Contributor

@swift-ci please benchmark

@swift-ci
Copy link
Contributor

swift-ci commented Nov 5, 2018

Build comment file:

Code size: -Osize

TEST OLD NEW DELTA RATIO
Improvement
RandomShuffle.o 3831 3655 -4.6% 1.05x
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

@harlanhaskins
Copy link
Contributor

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Nov 5, 2018

Build failed
Swift Test Linux Platform
Git Sha - 68a2a2c

@harlanhaskins
Copy link
Contributor

Failure is unrelated, let's run the tests again.

@swift-ci please test

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.

Looking good!

startIndex,
offsetBy: numericCast(random)
offsetBy: random
)
Copy link
Member

@lorentey lorentey Nov 8, 2018

Choose a reason for hiding this comment

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

Microscopic nit: we can collapse these four lines into a single line now

@Azoy
Copy link
Contributor Author

Azoy commented Nov 9, 2018

@harlanhaskins is this ready for merge?

@harlanhaskins
Copy link
Contributor

Looks good to me!

@swift-ci please smoke test and merge

@Azoy
Copy link
Contributor Author

Azoy commented Nov 9, 2018

@harlanhaskins I’m not sure CI picked that comment up. Try again?

@harlanhaskins
Copy link
Contributor

@swift-ci please smoke test

@harlanhaskins
Copy link
Contributor

Thanks, @Azoy!

@harlanhaskins harlanhaskins merged commit 703c571 into swiftlang:master Nov 9, 2018
@Azoy Azoy deleted the random-readability branch February 14, 2019 06: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.

4 participants