Skip to content

Add benchmarks for Substring.dropFirst(_:) and dropLast(_:) #32473

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
Jun 25, 2020

Conversation

natecook1000
Copy link
Member

These are self-slicing operations, so they should be fast even for this non-random-access collection.

Hoping to see a difference in this new benchmark from the change in #32451.

These are self-slicing operations, so they should be fast even for
this non-random-access collection.
@natecook1000
Copy link
Member Author

@swift-ci Please benchmark

@swift-ci
Copy link
Contributor

Performance: -O

Added MIN MAX MEAN MAX_RSS
SubstringDropFirst1 20 20 20
SubstringDropLast1 15 16 15

Code size: -O

Regression OLD NEW DELTA RATIO
Substring.o 15635 17043 +9.0% 0.92x

Performance: -Osize

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeStubToNSDate2 550 630 +14.5% 0.87x (?)
 
Improvement OLD NEW DELTA RATIO
FlattenListLoop 2466 1632 -33.8% 1.51x (?)
FlattenListFlatMap 4908 4295 -12.5% 1.14x (?)
SubstringComparable 17 15 -11.8% 1.13x
 
Added MIN MAX MEAN MAX_RSS
SubstringDropFirst1 21 21 21
SubstringDropLast1 16 16 16

Code size: -Osize

Regression OLD NEW DELTA RATIO
Substring.o 15754 17333 +10.0% 0.91x

Performance: -Onone

Regression OLD NEW DELTA RATIO
StringFromLongWholeSubstring 11 12 +9.1% 0.92x (?)
 
Added MIN MAX MEAN MAX_RSS
SubstringDropFirst1 106 106 106
SubstringDropLast1 101 102 101

Code size: -swiftlibs

Benchmark Check Report
⚠️ SubstringDropLast1 execution took 15 μs.
Increase the workload of SubstringDropLast1 to be more than 20 μs.
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

@natecook1000
Copy link
Member Author

@swift-ci Please smoke test and merge

@inline(never)
public func run_SubstringDropFirst1(_ N: Int) {
let s = quiteLong[...]
for _ in 1...N*500 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe 5000 to get a more reliable benchmark?

@natecook1000
Copy link
Member Author

@swift-ci Please smoke benchmark

@natecook1000
Copy link
Member Author

@swift-ci Please smoke test

@swift-ci
Copy link
Contributor

Performance: -O

Added MIN MAX MEAN MAX_RSS
SubstringDropFirst1 32 32 32
SubstringDropLast1 25 26 26

Code size: -O

Regression OLD NEW DELTA RATIO
Substring.o 15635 17155 +9.7% 0.91x

Performance: -Osize

Improvement OLD NEW DELTA RATIO
ObjectiveCBridgeStubToNSDateRef 2360 2200 -6.8% 1.07x (?)
 
Added MIN MAX MEAN MAX_RSS
SubstringDropFirst1 29 29 29
SubstringDropLast1 24 26 25

Code size: -Osize

Regression OLD NEW DELTA RATIO
Substring.o 15754 17315 +9.9% 0.91x

Performance: -Onone

Added MIN MAX MEAN MAX_RSS
SubstringDropFirst1 144 144 144
SubstringDropLast1 140 145 142

Code size: -swiftlibs

Benchmark Check Report
⛔️⏱ SubstringDropFirst1 has setup overhead of 2 μs (6.3%).
Move initialization of benchmark data to the setUpFunction registered in BenchmarkInfo.
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: 6-Core 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

@natecook1000 natecook1000 force-pushed the substring_dropfirst branch from c2144ae to 3aeead4 Compare June 24, 2020 18:38
@natecook1000
Copy link
Member Author

@swift-ci Please smoke benchmark

1 similar comment
@natecook1000
Copy link
Member Author

@swift-ci Please smoke benchmark

@swift-ci
Copy link
Contributor

Performance: -O

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeStubToNSDate2 540 620 +14.8% 0.87x (?)
ObjectiveCBridgeStubToNSDateRef 3500 3940 +12.6% 0.89x (?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 4340 4860 +12.0% 0.89x (?)
 
Improvement OLD NEW DELTA RATIO
NSStringConversion.MutableCopy.Rebridge 1020 931 -8.7% 1.10x (?)
NSStringConversion.MutableCopy.Rebridge.Medium 646 599 -7.3% 1.08x (?)
 
Added MIN MAX MEAN MAX_RSS
SubstringDropFirst1 42 42 42
SubstringDropLast1 32 32 32

Code size: -O

Regression OLD NEW DELTA RATIO
Substring.o 15635 17155 +9.7% 0.91x

Performance: -Osize

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeStubToNSDate2 550 620 +12.7% 0.89x (?)
 
Improvement OLD NEW DELTA RATIO
NSStringConversion.MutableCopy.UTF8 924 846 -8.4% 1.09x (?)
 
Added MIN MAX MEAN MAX_RSS
SubstringDropFirst1 42 42 42
SubstringDropLast1 32 32 32

Code size: -Osize

Regression OLD NEW DELTA RATIO
Substring.o 15754 17315 +9.9% 0.91x

Performance: -Onone

Regression OLD NEW DELTA RATIO
ObjectiveCBridgeStubToNSDate2 630 710 +12.7% 0.89x (?)
 
Added MIN MAX MEAN MAX_RSS
SubstringDropFirst1 215 215 215
SubstringDropLast1 203 212 207

Code size: -swiftlibs

Benchmark Check Report
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

@natecook1000
Copy link
Member Author

@swift-ci Please smoke test

@natecook1000 natecook1000 merged commit 9855496 into swiftlang:master Jun 25, 2020
@natecook1000 natecook1000 deleted the substring_dropfirst branch June 25, 2020 15:53
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