Skip to content

Performance Benchmarking of ExistentialSpecializer #24065

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
Apr 17, 2019

Conversation

rajbarik
Copy link
Contributor

A benchmark for showing performance improvements using ExistentialSpecializer. This shows more than 20x speedup when ExistentialSpecializer is used.

This benchmark has been significantly modified from the original implementation available at https://github.com/raywenderlich/swift-algorithm-club/tree/master/Bucket%20Sort
and
our issue created at:
kodecocodes/swift-algorithm-club#863

@rajbarik
Copy link
Contributor Author

rajbarik commented Apr 16, 2019

@atrick @slavapestov @eeckstein Please see the perf benchmark for ExistentialSpecializer.

@rajbarik rajbarik requested review from atrick and eeckstein April 16, 2019 21:14
Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

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

Thanks Raj!

I think it would be helpful if you add comments at the top of the benchmark source explaining why it is useful and how it exercises existential specialization.

@rajbarik rajbarik force-pushed the raj-es-perf-bench branch from 429945c to 78a0fe1 Compare April 17, 2019 00:17
// compiler (without ExistentialSpecializer) can not achieve this feat. With
// ExistentialSpecializer which enables generic specialization recursively in a
// call chain, we are able to specialize line 84 for InsertionSort on integers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@atrick please see the description here.

@rajbarik
Copy link
Contributor Author

I think it would be helpful if you add comments at the top of the benchmark source explaining why it is useful and how it exercises existential specialization.

I just uploaded a new version with comment. Please see it.

@atrick
Copy link
Contributor

atrick commented Apr 17, 2019

Thanks.

@atrick
Copy link
Contributor

atrick commented Apr 17, 2019

@swift-ci benchmark

@atrick
Copy link
Contributor

atrick commented Apr 17, 2019

@swift-ci smoke test

@swift-ci
Copy link
Contributor

Performance: -O

TEST OLD NEW DELTA RATIO
Regression
ObjectiveCBridgeStubFromNSDateRef 4080 4390 +7.6% 0.93x (?)
Improvement
FlattenListLoop 4710 4337 -7.9% 1.09x
Array2D 8112 7520 -7.3% 1.08x
RemoveWhereSwapInts 70 65 -7.1% 1.08x
MapReduce 426 397 -6.8% 1.07x (?)
MapReduceAnyCollection 426 398 -6.6% 1.07x (?)

Performance: -Osize

TEST OLD NEW DELTA RATIO
Improvement
DataAppendDataLargeToLarge 50800 36800 -27.6% 1.38x (?)
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

@rajbarik rajbarik merged commit cfc8409 into swiftlang:master Apr 17, 2019
@slavapestov
Copy link
Contributor

This breaks the build on Linux. Please use the Swift stdlib's random APIs instead of arc4random_uniform().

@rajbarik
Copy link
Contributor Author

I see. Let me fix it @slavapestov

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