Add benchmarks for a number of NSStringAPI functions#10914
Add benchmarks for a number of NSStringAPI functions#10914phausler merged 1 commit intoswiftlang:masterfrom
Conversation
|
@swift-ci please benchmark |
|
@swift-ci please smoke test |
|
@phausler 'please benchmark' takes forever, if you're interested in just a rough picture 'please smoke benchmark' is way faster. It will run all the benchmarks but with smaller number of samples, IIRC. |
|
gotcha, I will let this run-out for now just to get good baselines. I presume that the baselines are recorded when the tests are run? or per pull request doing an A/B execution before and after the patch? My local executions are just hoisting the methods into a benchmark lambda: import Foundation
#if os(macOS) || os(iOS)
import Darwin
let CLOCK_REALTIME = _CLOCK_REALTIME
#else
import Glibc
#endif
func benchmark(_ samples: Int, _ work: (Int) -> Void) -> Double {
var start = timespec()
var end = timespec()
clock_gettime(CLOCK_REALTIME, &start)
work(samples)
clock_gettime(CLOCK_REALTIME, &end)
return (Double(end.tv_sec) * 1.0e9 + Double(end.tv_nsec)) - (Double(start.tv_sec) * 1.0e9 + Double(start.tv_nsec)) / Double(samples)
} |
|
I think it's the latter, as in A/B every time. |
|
hmm is there a way I can cancel a build on CI? |
|
@swift-ci please smoke benchmark |
|
@phausler some of the builds get cancelled automatically once the PR changes, not sure about the benchmark ones. |
|
I was actually able to abort it |
|
interesting followup results: I was able to eek out performance improvements for the following cases: These all were re-writes using either direct So far I am seeing some cases be anywhere from 2x-3x up to 40x improvements. It is also worth noting that some of the tests regress when not using |
|
|
Build comment file:Build failed before running benchmark. |
ae0cbce to
78cf2aa
Compare
|
@swift-ci please smoke benchmark |
|
@swift-ci please smoke test |
Build comment file:Optimized (O)Regression (18)
Improvement (17)
No Changes (286)
Added (17)
Unoptimized (Onone)Regression (3)
Improvement (3)
No Changes (315)
Added (17)
Hardware Overview |
|
We should probably add more of these to get full coverage but these should do for now to get a feeling of how NSStringAPI extensions are performing with the incoming changes |
This adds a number of simple benchmarks for common NSString APIs that are exposed on String