Skip to content

[benchmark] Restore running benchmarks by ordinal numbers and related bugfixes #12415

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 10 commits into from
Jul 12, 2018

Conversation

palimondo
Copy link
Contributor

@palimondo palimondo commented Oct 13, 2017

This PR reintroduces functionality lost during the BenchmarkInfo refactoring to run benchmarks by numbers and fixes bugs introduced in the subsequent move to the use of tags for filtering benchmarks by category. Also adds regression tests for the fixed bugs and updates the related documentation.

  • Fix: Better tags in benchmark list
  • Fix: running with --num-iters=1
  • Fix: Running skip-tag-marked benchmark
  • Fix: Benchmark_Driver running tests
  • Restore running benchmarks by numbers

See individual commit descriptions for more details.

The restored functionality assigns all registered benchmarks an ordinal number (in alphabetical order). This can be used as a shortcut to invoke the given tests by number. This test number is also reported when running benchmarks and when listing available benchmarks with the --list option. The updated list format looks like this:

#,Test,[Tags]
2,AngryPhonebook,[String, api, validation]
… 

Note: Test number 1 is Ackermann, which is marked as “skip”, so it’s not listed with the default skip-tags value.

Output format when running test is structurally unchanged, but the first column again reports the index number of the test, instead of counting the executed tests:

$ Benchmark_O --tags=Dictionary,algorithm
#,TEST,SAMPLES,MIN(us),MAX(us),MEAN(us),SD(us),MEDIAN(us)
126,DictOfArraysToArrayOfDicts,1,4225,4225,4225,0,4225
597,TwoSum,1,6601,6601,6601,0,6601
607,WordCountHistogramASCII,1,29537,29537,29537,0,29537
608,WordCountHistogramUTF16,1,53621,53621,53621,0,53621
609,WordCountUniqueASCII,1,11145,11145,11145,0,11145
610,WordCountUniqueUTF16,1,22791,22791,22791,0,22791

Totals,6,127920,127920,127920,0,0

This fixes a bug where running tests with Benchmark_Driver reported all tests as being number 1, because every independent test run was first during that Benchmark_O invocation.

@palimondo
Copy link
Contributor Author

@gottesmm, @moiseev, @atrick Please review.

@palimondo
Copy link
Contributor Author

@jrose-apple Can you trigger a smoke benchmark, please? Thank you!

@palimondo
Copy link
Contributor Author

@swift-ci Please smoke benchmark
@swift-ci Please Python lint
(I know I don't have perfmissions to run these… hoping to attract someone who does.)

@palimondo palimondo changed the title [benchmark] Restore running benchmarks by ordinal numbers [WIP][benchmark] Restore running benchmarks by ordinal numbers Oct 13, 2017
@palimondo palimondo changed the title [WIP][benchmark] Restore running benchmarks by ordinal numbers [benchmark] Restore running benchmarks by ordinal numbers Oct 13, 2017
@palimondo
Copy link
Contributor Author

@gottesmm, @moiseev, @atrick Please review… smoke benchmark & python lint, pretty please.

@jrose-apple
Copy link
Contributor

Heh, okay.

@swift-ci Please smoke benchmark

@jrose-apple
Copy link
Contributor

@swift-ci Please Python lint

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!

* `--tags`
* Run tests that are labeled with specified [tags]
(https://github.com/apple/swift/blob/master/benchmark/utils/TestsUtils.swift#L19)
(coma separated list)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want to make it clear that a benchmark requires ALL tags?

Copy link
Contributor Author

@palimondo palimondo Oct 13, 2017

Choose a reason for hiding this comment

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

Gladly, I'm just having trouble formulating proper english sentence here… How about:

  • Run tests that are labeled with specified tags (coma separated list); Multiple tags are interpreted as logical AND, i.e. run only test that are labeled with all the supplied tags

?

Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds fine to me.

return true
registeredBenchmarks.sort()
let indices = Dictionary(uniqueKeysWithValues:
zip(registeredBenchmarks.map{$0.name}, 1...registeredBenchmarks.count))
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use just 1.... It will be much shorter with the same result.


tests = registeredBenchmarks.filter { benchmark in
if benchmarkNamesOrIndices.isEmpty {
return benchmark.tags.isSuperset(of:_tags) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a space after a colon.

@@ -80,7 +92,7 @@ public struct BenchmarkInfo {
/// A set of category tags that describe this benchmark. This is used by the
/// harness to allow for easy slicing of the set of benchmarks along tag
/// boundaries, e.x.: run all string benchmarks or ref count benchmarks, etc.
public var tags: [BenchmarkCategory]
public var tags: Set<BenchmarkCategory>
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of using a Set, please us an OptionSet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure this can work, BenchmarkCategory is String backed enum (it is used for printing the categories) and IIRC the OptionSet requires enum's rawValue to be FixedWidthInteger. Am I missing something?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure.

continue
tests.append(m.group(1))
driver.append('--skip-tags=')
indices, names = zip(*[
Copy link
Contributor

Choose a reason for hiding this comment

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

I always thought zip returns a single list. How is that supposed to work?

Copy link
Contributor Author

@palimondo palimondo Oct 13, 2017

Choose a reason for hiding this comment

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

I learned it over at Stack Overflow. Adding the star before iterable will turn the zip around and do unzip. It says so right in the official documentation, too:

zip() in conjunction with the * operator can be used to unzip a list

Copy link
Contributor

@moiseev moiseev Oct 13, 2017

Choose a reason for hiding this comment

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

I see now.. It's a little too clever. How about we at least extract is into a separate variable?

indexNamePairs = [line.split('\t')[:2] for line in subprocess.check_output(driver).split('\n')[1:-1]]
indices, names = zip(*indexNamePairs)

At least pairs in the name indicates what's going to happen when zip is invoked this way.

Copy link
Contributor

Choose a reason for hiding this comment

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

Wow. I have to say I skimmed over this line without parsing it. If python doesn't have an obvious syntax, it'd be nice to comment "# this unzips the array of pairs into two arrays"

@@ -407,6 +377,11 @@ func runBench(_ test: Test, _ c: TestConfig) -> BenchResults {
} else {
// Compute the scaling factor if a fixed c.fixedNumIters is not specified.
scale = c.fixedNumIters
if scale == 1 { // FIXME: dirty fix. This method severly needs a refactoring
Copy link
Contributor

Choose a reason for hiding this comment

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

It is not clear from the comment what the dirty fix is for...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was just venting… I'll remove the comment. The change correctly fixes the previously broken case when you specify --num-iters=1. I just very much dislike the code repetition.

I hope to completely refactor it, right after demonstrating that my proposed approach works in Benchmark_Driver. If it works out, next step would be to move that logic down to DriverUtils, implying a total rework of this part of the code.

@swift-ci
Copy link
Contributor

Build comment file:

Optimized (O)

Regression (12)
TEST OLD NEW DELTA SPEEDUP
Calculator 31 36 +16.1% 0.86x
ProtocolDispatch 2770 3095 +11.7% 0.89x
ProtocolDispatch2 130 144 +10.8% 0.90x
BitCount 134 147 +9.7% 0.91x (?)
SuffixAnySeqCRangeIterLazy 5103 5551 +8.8% 0.92x
SetIsSubsetOf 294 319 +8.5% 0.92x
ObserverForwarderStruct 1142 1220 +6.8% 0.94x
Phonebook 5849 6248 +6.8% 0.94x
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 5149 5488 +6.6% 0.94x (?)
StrToInt 1796 1907 +6.2% 0.94x
ArrayAppendAscii 18890 19977 +5.8% 0.95x
SortSortedStrings 851 896 +5.3% 0.95x
Improvement (16)
TEST OLD NEW DELTA SPEEDUP
StaticArray 6 5 -16.7% 1.20x
PopFrontUnsafePointer 6097 5243 -14.0% 1.16x
PopFrontArray 1283 1117 -12.9% 1.15x
ArraySetElement 455 398 -12.5% 1.14x
PopFrontArrayGeneric 1285 1126 -12.4% 1.14x
CaptureProp 4599 4164 -9.5% 1.10x
ObjectiveCBridgeStubNSDateMutationRef 13398 12165 -9.2% 1.10x (?)
ObjectiveCBridgeStubToNSStringRef 117 109 -6.8% 1.07x
SuffixAnySeqCntRange 16 15 -6.2% 1.07x
SuffixAnySeqCntRangeLazy 16 15 -6.2% 1.07x
ReversedDictionary 113 106 -6.2% 1.07x
ObjectiveCBridgeStubFromNSDate 3859 3625 -6.1% 1.06x
PrefixCountableRange 19 18 -5.3% 1.06x
ArrayAppendLatin1 44542 42274 -5.1% 1.05x
ObjectiveCBridgeStubToNSString 1581 1504 -4.9% 1.05x
AngryPhonebook 3102 2954 -4.8% 1.05x
No Changes (306)
TEST OLD NEW DELTA SPEEDUP
AnyHashableWithAClass 67754 69999 +3.3% 0.97x (?)
Array2D 1945 1979 +1.7% 0.98x
ArrayAppend 1074 1080 +0.6% 0.99x
ArrayAppendArrayOfInt 599 597 -0.3% 1.00x
ArrayAppendFromGeneric 599 598 -0.2% 1.00x
ArrayAppendGenericStructs 1222 1220 -0.2% 1.00x (?)
ArrayAppendLazyMap 922 924 +0.2% 1.00x (?)
ArrayAppendOptionals 1231 1219 -1.0% 1.01x (?)
ArrayAppendRepeatCol 1000 999 -0.1% 1.00x (?)
ArrayAppendReserved 839 844 +0.6% 0.99x
ArrayAppendSequence 912 913 +0.1% 1.00x (?)
ArrayAppendStrings 15050 15136 +0.6% 0.99x (?)
ArrayAppendToFromGeneric 599 598 -0.2% 1.00x
ArrayAppendToGeneric 599 598 -0.2% 1.00x
ArrayAppendUTF16 41370 43301 +4.7% 0.96x (?)
ArrayInClass 61 61 +0.0% 1.00x
ArrayLiteral 0 0 +0.0% 1.00x
ArrayOfGenericPOD 230 230 +0.0% 1.00x
ArrayOfGenericRef 4002 4010 +0.2% 1.00x (?)
ArrayOfPOD 177 177 +0.0% 1.00x
ArrayOfRef 3917 3942 +0.6% 0.99x (?)
ArrayPlusEqualArrayOfInt 599 597 -0.3% 1.00x
ArrayPlusEqualFiveElementCollection 4807 4770 -0.8% 1.01x (?)
ArrayPlusEqualSingleElementCollection 1072 1078 +0.6% 0.99x
ArrayPlusEqualThreeElements 1633 1621 -0.7% 1.01x
ArraySubscript 1498 1478 -1.3% 1.01x
ArrayValueProp 6 6 +0.0% 1.00x
ArrayValueProp2 6 6 +0.0% 1.00x
ArrayValueProp3 6 6 +0.0% 1.00x
ArrayValueProp4 6 6 +0.0% 1.00x
ByteSwap 114 113 -0.9% 1.01x
CStringLongAscii 4512 4718 +4.6% 0.96x
CStringLongNonAscii 2195 2209 +0.6% 0.99x
CStringShortAscii 4825 4816 -0.2% 1.00x
CharIndexing_ascii_unicodeScalars 13444 13442 -0.0% 1.00x (?)
CharIndexing_ascii_unicodeScalars_Backwards 11255 11272 +0.2% 1.00x
CharIndexing_chinese_unicodeScalars 10190 10195 +0.0% 1.00x (?)
CharIndexing_chinese_unicodeScalars_Backwards 8557 8556 -0.0% 1.00x (?)
CharIndexing_japanese_unicodeScalars 16079 16092 +0.1% 1.00x
CharIndexing_japanese_unicodeScalars_Backwards 13476 13478 +0.0% 1.00x (?)
CharIndexing_korean_unicodeScalars 13039 13033 -0.0% 1.00x (?)
CharIndexing_korean_unicodeScalars_Backwards 10919 10932 +0.1% 1.00x (?)
CharIndexing_punctuatedJapanese_unicodeScalars 2472 2493 +0.8% 0.99x
CharIndexing_punctuatedJapanese_unicodeScalars_Backwards 2087 2106 +0.9% 0.99x
CharIndexing_punctuated_unicodeScalars 3083 3109 +0.8% 0.99x
CharIndexing_punctuated_unicodeScalars_Backwards 2600 2616 +0.6% 0.99x
CharIndexing_russian_unicodeScalars 11205 11221 +0.1% 1.00x
CharIndexing_russian_unicodeScalars_Backwards 9394 9406 +0.1% 1.00x
CharIndexing_tweet_unicodeScalars 26524 26460 -0.2% 1.00x
CharIndexing_tweet_unicodeScalars_Backwards 22175 22171 -0.0% 1.00x
CharIndexing_utf16_unicodeScalars 81926 81482 -0.5% 1.01x
CharIndexing_utf16_unicodeScalars_Backwards 60322 60415 +0.2% 1.00x
CharIteration_ascii_unicodeScalars 15625 15594 -0.2% 1.00x
CharIteration_ascii_unicodeScalars_Backwards 16572 16563 -0.1% 1.00x (?)
CharIteration_chinese_unicodeScalars 11837 11808 -0.2% 1.00x
CharIteration_chinese_unicodeScalars_Backwards 12542 12533 -0.1% 1.00x
CharIteration_japanese_unicodeScalars 18705 18679 -0.1% 1.00x
CharIteration_japanese_unicodeScalars_Backwards 19839 19831 -0.0% 1.00x (?)
CharIteration_korean_unicodeScalars 15156 15119 -0.2% 1.00x
CharIteration_korean_unicodeScalars_Backwards 16067 16063 -0.0% 1.00x (?)
CharIteration_punctuatedJapanese_unicodeScalars 2843 2823 -0.7% 1.01x
CharIteration_punctuatedJapanese_unicodeScalars_Backwards 2984 2975 -0.3% 1.00x
CharIteration_punctuated_unicodeScalars 3550 3536 -0.4% 1.00x
CharIteration_punctuated_unicodeScalars_Backwards 3741 3736 -0.1% 1.00x
CharIteration_russian_unicodeScalars 13022 12997 -0.2% 1.00x
CharIteration_russian_unicodeScalars_Backwards 13802 13793 -0.1% 1.00x (?)
CharIteration_tweet_unicodeScalars 30798 30737 -0.2% 1.00x
CharIteration_tweet_unicodeScalars_Backwards 32772 32727 -0.1% 1.00x (?)
CharIteration_utf16_unicodeScalars 78378 80941 +3.3% 0.97x
CharIteration_utf16_unicodeScalars_Backwards 97670 97779 +0.1% 1.00x
CharacterLiteralsLarge 6073 6018 -0.9% 1.01x
CharacterLiteralsSmall 404 403 -0.2% 1.00x
Chars 428 427 -0.2% 1.00x
ClassArrayGetter 13 13 +0.0% 1.00x
DeadArray 181 184 +1.7% 0.98x
Dictionary 580 572 -1.4% 1.01x
Dictionary2 1923 1896 -1.4% 1.01x (?)
Dictionary2OfObjects 3324 3307 -0.5% 1.01x
Dictionary3 469 470 +0.2% 1.00x (?)
Dictionary3OfObjects 838 838 +0.0% 1.00x
DictionaryBridge 2628 2570 -2.2% 1.02x (?)
DictionaryGroup 274 273 -0.4% 1.00x
DictionaryGroupOfObjects 1823 1791 -1.8% 1.02x
DictionaryLiteral 1482 1490 +0.5% 0.99x
DictionaryOfObjects 2289 2257 -1.4% 1.01x
DictionaryRemove 2446 2510 +2.6% 0.97x
DictionaryRemoveOfObjects 23814 23763 -0.2% 1.00x
DictionarySwap 415 415 +0.0% 1.00x
DictionarySwapOfObjects 7631 7424 -2.7% 1.03x
DropFirstAnyCollection 55 55 +0.0% 1.00x
DropFirstAnyCollectionLazy 75379 75421 +0.1% 1.00x (?)
DropFirstAnySeqCRangeIter 28603 28513 -0.3% 1.00x
DropFirstAnySeqCRangeIterLazy 28736 28507 -0.8% 1.01x (?)
DropFirstAnySeqCntRange 50 50 +0.0% 1.00x
DropFirstAnySeqCntRangeLazy 50 50 +0.0% 1.00x
DropFirstAnySequence 6262 6289 +0.4% 1.00x
DropFirstAnySequenceLazy 6261 6288 +0.4% 1.00x
DropFirstArray 30 30 +0.0% 1.00x
DropFirstArrayLazy 30 30 +0.0% 1.00x
DropFirstCountableRange 19 19 +0.0% 1.00x
DropFirstCountableRangeLazy 18 18 +0.0% 1.00x
DropFirstSequence 2019 2019 +0.0% 1.00x
DropFirstSequenceLazy 1944 1944 +0.0% 1.00x
DropLastAnyCollection 21 21 +0.0% 1.00x
DropLastAnyCollectionLazy 25141 25134 -0.0% 1.00x (?)
DropLastAnySeqCRangeIter 4758 4764 +0.1% 1.00x
DropLastAnySeqCRangeIterLazy 4759 4762 +0.1% 1.00x (?)
DropLastAnySeqCntRange 16 16 +0.0% 1.00x
DropLastAnySeqCntRangeLazy 16 16 +0.0% 1.00x
DropLastAnySequence 6770 7099 +4.9% 0.95x
DropLastAnySequenceLazy 6714 6709 -0.1% 1.00x (?)
DropLastArray 10 10 +0.0% 1.00x
DropLastArrayLazy 10 10 +0.0% 1.00x
DropLastCountableRange 6 6 +0.0% 1.00x
DropLastCountableRangeLazy 6 6 +0.0% 1.00x
DropLastSequence 608 605 -0.5% 1.00x
DropLastSequenceLazy 609 605 -0.7% 1.01x
DropWhileAnyCollection 68 68 +0.0% 1.00x
DropWhileAnyCollectionLazy 90 90 +0.0% 1.00x
DropWhileAnySeqCRangeIter 23064 23038 -0.1% 1.00x (?)
DropWhileAnySeqCRangeIterLazy 89 89 +0.0% 1.00x
DropWhileAnySeqCntRange 63 63 +0.0% 1.00x
DropWhileAnySeqCntRangeLazy 89 89 +0.0% 1.00x
DropWhileAnySequence 7261 7341 +1.1% 0.99x
DropWhileAnySequenceLazy 1933 1933 +0.0% 1.00x
DropWhileArray 43 43 +0.0% 1.00x
DropWhileArrayLazy 78 78 +0.0% 1.00x
DropWhileCountableRange 19 19 +0.0% 1.00x
DropWhileCountableRangeLazy 70 70 +0.0% 1.00x
DropWhileSequence 1624 1624 +0.0% 1.00x
DropWhileSequenceLazy 47 46 -2.1% 1.02x
EqualStringSubstring 388 390 +0.5% 0.99x
EqualSubstringString 388 389 +0.3% 1.00x
EqualSubstringSubstring 389 388 -0.3% 1.00x
EqualSubstringSubstringGenericEquatable 391 394 +0.8% 0.99x
ErrorHandling 2077 2053 -1.2% 1.01x (?)
ExclusivityGlobal 3 3 +0.0% 1.00x
ExclusivityInMatSet 18 18 +0.0% 1.00x
ExclusivityIndependent 2 2 +0.0% 1.00x
FilterEvenUsingReduce 1314 1289 -1.9% 1.02x (?)
FilterEvenUsingReduceInto 145 147 +1.4% 0.99x (?)
FrequenciesUsingReduce 7415 7358 -0.8% 1.01x
FrequenciesUsingReduceInto 4174 4167 -0.2% 1.00x (?)
Hanoi 3456 3614 +4.6% 0.96x
HashTest 1629 1663 +2.1% 0.98x
Histogram 280 279 -0.4% 1.00x (?)
Integrate 251 254 +1.2% 0.99x
IterateData 1410 1376 -2.4% 1.02x
Join 393 385 -2.0% 1.02x
LazilyFilteredArrayContains 94933 94965 +0.0% 1.00x (?)
LazilyFilteredArrays 65782 65855 +0.1% 1.00x (?)
LazilyFilteredRange 3626 3624 -0.1% 1.00x (?)
LessSubstringSubstring 389 388 -0.3% 1.00x
LessSubstringSubstringGenericComparable 388 389 +0.3% 1.00x
LinkedList 6975 6996 +0.3% 1.00x
MapReduce 362 360 -0.6% 1.01x
MapReduceAnyCollection 363 363 +0.0% 1.00x
MapReduceAnyCollectionShort 2094 2095 +0.0% 1.00x
MapReduceClass 3065 3065 +0.0% 1.00x
MapReduceClassShort 4547 4545 -0.0% 1.00x (?)
MapReduceLazyCollection 13 13 +0.0% 1.00x
MapReduceLazyCollectionShort 36 36 +0.0% 1.00x
MapReduceLazySequence 90 90 +0.0% 1.00x
MapReduceSequence 438 447 +2.1% 0.98x
MapReduceShort 1983 1981 -0.1% 1.00x (?)
MapReduceShortString 22 21 -4.5% 1.05x
MapReduceString 107 105 -1.9% 1.02x
Memset 235 234 -0.4% 1.00x
MonteCarloE 10343 10379 +0.3% 1.00x
MonteCarloPi 43944 43980 +0.1% 1.00x
NSDictionaryCastToSwift 5294 5448 +2.9% 0.97x (?)
NSError 306 301 -1.6% 1.02x (?)
NSStringConversion 355 360 +1.4% 0.99x
NopDeinit 21372 21369 -0.0% 1.00x (?)
ObjectAllocation 178 179 +0.6% 0.99x
ObjectiveCBridgeFromNSArrayAnyObject 22828 23024 +0.9% 0.99x
ObjectiveCBridgeFromNSArrayAnyObjectForced 3475 3473 -0.1% 1.00x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 40535 40046 -1.2% 1.01x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 34065 34397 +1.0% 0.99x
ObjectiveCBridgeFromNSDictionaryAnyObject 120228 120480 +0.2% 1.00x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 93026 91194 -2.0% 1.02x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 103815 103839 +0.0% 1.00x (?)
ObjectiveCBridgeFromNSSetAnyObject 64471 64539 +0.1% 1.00x (?)
ObjectiveCBridgeFromNSSetAnyObjectForced 4252 4213 -0.9% 1.01x
ObjectiveCBridgeFromNSSetAnyObjectToString 67887 68092 +0.3% 1.00x (?)
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 69014 68444 -0.8% 1.01x
ObjectiveCBridgeFromNSString 988 987 -0.1% 1.00x (?)
ObjectiveCBridgeFromNSStringForced 1869 1870 +0.1% 1.00x
ObjectiveCBridgeStubDataAppend 3866 3802 -1.7% 1.02x (?)
ObjectiveCBridgeStubDateAccess 181 181 +0.0% 1.00x
ObjectiveCBridgeStubDateMutation 272 272 +0.0% 1.00x
ObjectiveCBridgeStubFromArrayOfNSString 24910 25035 +0.5% 1.00x (?)
ObjectiveCBridgeStubFromNSDateRef 4100 4151 +1.2% 0.99x
ObjectiveCBridgeStubFromNSString 562 551 -2.0% 1.02x
ObjectiveCBridgeStubFromNSStringRef 152 146 -3.9% 1.04x
ObjectiveCBridgeStubNSDataAppend 2518 2423 -3.8% 1.04x (?)
ObjectiveCBridgeStubNSDateRefAccess 313 313 +0.0% 1.00x
ObjectiveCBridgeStubToArrayOfNSString 29448 29847 +1.4% 0.99x (?)
ObjectiveCBridgeStubToNSDate 15181 15073 -0.7% 1.01x (?)
ObjectiveCBridgeStubToNSDateRef 3335 3318 -0.5% 1.01x (?)
ObjectiveCBridgeStubURLAppendPath 218270 223492 +2.4% 0.98x (?)
ObjectiveCBridgeStubURLAppendPathRef 227478 221935 -2.4% 1.02x
ObjectiveCBridgeToNSArray 29365 29163 -0.7% 1.01x (?)
ObjectiveCBridgeToNSDictionary 47663 46666 -2.1% 1.02x (?)
ObjectiveCBridgeToNSSet 40624 41194 +1.4% 0.99x
ObjectiveCBridgeToNSString 1270 1269 -0.1% 1.00x
ObserverClosure 2328 2352 +1.0% 0.99x
ObserverPartiallyAppliedMethod 3832 3831 -0.0% 1.00x (?)
ObserverUnappliedMethod 2753 2732 -0.8% 1.01x
OpenClose 3 3 +0.0% 1.00x
PolymorphicCalls 17 17 +0.0% 1.00x
PrefixAnyCollection 55 55 +0.0% 1.00x
PrefixAnyCollectionLazy 75315 75766 +0.6% 0.99x (?)
PrefixAnySeqCRangeIter 22384 22399 +0.1% 1.00x (?)
PrefixAnySeqCRangeIterLazy 22441 22383 -0.3% 1.00x
PrefixAnySeqCntRange 50 50 +0.0% 1.00x
PrefixAnySeqCntRangeLazy 50 50 +0.0% 1.00x
PrefixAnySequence 5558 5551 -0.1% 1.00x (?)
PrefixAnySequenceLazy 5541 5559 +0.3% 1.00x (?)
PrefixArray 30 30 +0.0% 1.00x
PrefixArrayLazy 30 30 +0.0% 1.00x
PrefixCountableRangeLazy 18 18 +0.0% 1.00x
PrefixSequence 1515 1542 +1.8% 0.98x
PrefixSequenceLazy 1459 1460 +0.1% 1.00x
PrefixWhileAnyCollection 93 93 +0.0% 1.00x
PrefixWhileAnyCollectionLazy 66 66 +0.0% 1.00x
PrefixWhileAnySeqCRangeIter 13030 13229 +1.5% 0.98x
PrefixWhileAnySeqCRangeIterLazy 66 66 +0.0% 1.00x
PrefixWhileAnySeqCntRange 88 88 +0.0% 1.00x
PrefixWhileAnySeqCntRangeLazy 66 66 +0.0% 1.00x
PrefixWhileAnySequence 14486 14461 -0.2% 1.00x (?)
PrefixWhileAnySequenceLazy 1436 1436 +0.0% 1.00x
PrefixWhileArray 68 68 +0.0% 1.00x
PrefixWhileArrayLazy 37 37 +0.0% 1.00x
PrefixWhileCountableRange 29 29 +0.0% 1.00x
PrefixWhileCountableRangeLazy 18 18 +0.0% 1.00x
PrefixWhileSequence 364 360 -1.1% 1.01x
PrefixWhileSequenceLazy 28 28 +0.0% 1.00x
Prims 764 764 +0.0% 1.00x
PrimsSplit 775 786 +1.4% 0.99x
RC4 158 158 +0.0% 1.00x
RGBHistogram 2180 2170 -0.5% 1.00x (?)
RGBHistogramOfObjects 23310 23275 -0.2% 1.00x (?)
RangeAssignment 365 362 -0.8% 1.01x
RangeIterationSigned 152 151 -0.7% 1.01x (?)
RangeIterationSigned64 151 151 +0.0% 1.00x
RangeIterationUnsigned 152 152 +0.0% 1.00x
RecursiveOwnedParameter 2308 2306 -0.1% 1.00x
ReversedArray 45 46 +2.2% 0.98x
ReversedBidirectional 29243 29265 +0.1% 1.00x (?)
SetExclusiveOr 2862 2906 +1.5% 0.98x
SetExclusiveOr_OfObjects 8344 8309 -0.4% 1.00x (?)
SetIntersect 259 258 -0.4% 1.00x (?)
SetIntersect_OfObjects 1714 1721 +0.4% 1.00x (?)
SetIsSubsetOf_OfObjects 388 404 +4.1% 0.96x
SetUnion 2549 2582 +1.3% 0.99x (?)
SetUnion_OfObjects 6954 6920 -0.5% 1.00x (?)
SevenBoom 1576 1575 -0.1% 1.00x (?)
Sim2DArray 348 348 +0.0% 1.00x
SortLargeExistentials 8404 8467 +0.7% 0.99x
SortLettersInPlace 1150 1149 -0.1% 1.00x
SortStrings 1641 1700 +3.6% 0.97x
SortStringsUnicode 8063 8118 +0.7% 0.99x
StackPromo 22809 22509 -1.3% 1.01x
StrComplexWalk 1648 1648 +0.0% 1.00x
StringAdder 3518 3509 -0.3% 1.00x
StringBuilder 1008 999 -0.9% 1.01x (?)
StringBuilderLong 951 930 -2.2% 1.02x
StringEdits 169225 169153 -0.0% 1.00x (?)
StringEnumRawValueInitialization 802 815 +1.6% 0.98x
StringEqualPointerComparison 394 394 +0.0% 1.00x
StringFromLongWholeSubstring 178 180 +1.1% 0.99x (?)
StringFromLongWholeSubstringGeneric 90 86 -4.4% 1.05x
StringHasPrefix 9 9 +0.0% 1.00x
StringHasPrefixUnicode 14695 14524 -1.2% 1.01x (?)
StringHasSuffix 9 9 +0.0% 1.00x
StringHasSuffixUnicode 62025 62023 -0.0% 1.00x (?)
StringInterpolation 10933 10959 +0.2% 1.00x (?)
StringMatch 7496 7543 +0.6% 0.99x
StringUTF16Builder 1921 1900 -1.1% 1.01x
StringWalk 1483 1493 +0.7% 0.99x
StringWithCString 59224 59431 +0.3% 1.00x
SubstringComparable 1617 1623 +0.4% 1.00x
SubstringEqualString 1422 1421 -0.1% 1.00x
SubstringEquatable 3677 3666 -0.3% 1.00x
SubstringFromLongString 10 10 +0.0% 1.00x
SubstringFromLongStringGeneric 62 62 +0.0% 1.00x
SuffixAnyCollection 21 21 +0.0% 1.00x
SuffixAnyCollectionLazy 25088 25341 +1.0% 0.99x (?)
SuffixAnySeqCRangeIter 5088 5275 +3.7% 0.96x
SuffixAnySequence 6754 6905 +2.2% 0.98x
SuffixAnySequenceLazy 6777 7008 +3.4% 0.97x
SuffixArray 10 10 +0.0% 1.00x
SuffixArrayLazy 10 10 +0.0% 1.00x
SuffixCountableRange 6 6 +0.0% 1.00x
SuffixCountableRangeLazy 6 6 +0.0% 1.00x
SuffixSequence 4688 4765 +1.6% 0.98x
SuffixSequenceLazy 4690 4779 +1.9% 0.98x
SumUsingReduce 97 97 +0.0% 1.00x
SumUsingReduceInto 97 96 -1.0% 1.01x
SuperChars 84849 84967 +0.1% 1.00x (?)
TwoSum 939 937 -0.2% 1.00x (?)
TypeFlood 0 0 +0.0% 1.00x
UTF8Decode 254 254 +0.0% 1.00x
Walsh 384 382 -0.5% 1.01x
XorLoop 347 347 +0.0% 1.00x

Unoptimized (Onone)

Regression (1)
TEST OLD NEW DELTA SPEEDUP
ObjectiveCBridgeStubDataAppend 4433 5060 +14.1% 0.88x
Improvement (8)
TEST OLD NEW DELTA SPEEDUP
ObjectiveCBridgeStubNSDateMutationRef 16982 15155 -10.8% 1.12x
ProtocolDispatch 8284 7661 -7.5% 1.08x
Sim2DArray 47345 44063 -6.9% 1.07x
ClassArrayGetter 1074 1003 -6.6% 1.07x
ObjectiveCBridgeStubToNSDate 15269 14392 -5.7% 1.06x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectForced 7888 7462 -5.4% 1.06x
Calculator 1144 1084 -5.2% 1.06x
ObjectiveCBridgeFromNSDictionaryAnyObjectToStringForced 107200 102066 -4.8% 1.05x (?)
No Changes (325)
TEST OLD NEW DELTA SPEEDUP
AngryPhonebook 5089 4968 -2.4% 1.02x
AnyHashableWithAClass 84663 84575 -0.1% 1.00x (?)
Array2D 652519 652036 -0.1% 1.00x (?)
ArrayAppend 4160 4200 +1.0% 0.99x
ArrayAppendArrayOfInt 657 657 +0.0% 1.00x
ArrayAppendAscii 51176 51168 -0.0% 1.00x (?)
ArrayAppendFromGeneric 659 660 +0.2% 1.00x (?)
ArrayAppendGenericStructs 1300 1285 -1.2% 1.01x (?)
ArrayAppendLatin1 80690 79993 -0.9% 1.01x
ArrayAppendLazyMap 231675 231847 +0.1% 1.00x (?)
ArrayAppendOptionals 1299 1339 +3.1% 0.97x
ArrayAppendRepeatCol 235600 236595 +0.4% 1.00x (?)
ArrayAppendReserved 4139 3988 -3.6% 1.04x
ArrayAppendSequence 76332 76361 +0.0% 1.00x (?)
ArrayAppendStrings 15227 15225 -0.0% 1.00x (?)
ArrayAppendToFromGeneric 659 660 +0.2% 1.00x
ArrayAppendToGeneric 661 659 -0.3% 1.00x (?)
ArrayAppendUTF16 75925 75796 -0.2% 1.00x (?)
ArrayInClass 6314 6418 +1.6% 0.98x
ArrayLiteral 1758 1749 -0.5% 1.01x
ArrayOfGenericPOD 1383 1382 -0.1% 1.00x
ArrayOfGenericRef 10442 10111 -3.2% 1.03x (?)
ArrayOfPOD 792 792 +0.0% 1.00x
ArrayOfRef 9322 9240 -0.9% 1.01x (?)
ArrayPlusEqualArrayOfInt 659 658 -0.2% 1.00x
ArrayPlusEqualFiveElementCollection 307785 302635 -1.7% 1.02x
ArrayPlusEqualSingleElementCollection 301847 303161 +0.4% 1.00x (?)
ArrayPlusEqualThreeElements 10992 11219 +2.1% 0.98x (?)
ArraySetElement 4580 4580 +0.0% 1.00x
ArraySubscript 84996 84437 -0.7% 1.01x
ArrayValueProp 3612 3604 -0.2% 1.00x (?)
ArrayValueProp2 19058 19376 +1.7% 0.98x (?)
ArrayValueProp3 4090 4231 +3.4% 0.97x
ArrayValueProp4 4011 4029 +0.4% 1.00x
BitCount 1614 1597 -1.1% 1.01x
ByteSwap 4146 4160 +0.3% 1.00x
CStringLongAscii 4773 4771 -0.0% 1.00x (?)
CStringLongNonAscii 2416 2415 -0.0% 1.00x (?)
CStringShortAscii 8751 8797 +0.5% 0.99x
CaptureProp 126187 126320 +0.1% 1.00x
CharIndexing_ascii_unicodeScalars 492587 496976 +0.9% 0.99x (?)
CharIndexing_ascii_unicodeScalars_Backwards 530594 523253 -1.4% 1.01x
CharIndexing_chinese_unicodeScalars 371751 362516 -2.5% 1.03x
CharIndexing_chinese_unicodeScalars_Backwards 401714 392050 -2.4% 1.02x
CharIndexing_japanese_unicodeScalars 590794 578231 -2.1% 1.02x
CharIndexing_japanese_unicodeScalars_Backwards 642734 625554 -2.7% 1.03x
CharIndexing_korean_unicodeScalars 477570 481686 +0.9% 0.99x (?)
CharIndexing_korean_unicodeScalars_Backwards 514187 502681 -2.2% 1.02x
CharIndexing_punctuatedJapanese_unicodeScalars 85363 85723 +0.4% 1.00x (?)
CharIndexing_punctuatedJapanese_unicodeScalars_Backwards 92214 90136 -2.3% 1.02x
CharIndexing_punctuated_unicodeScalars 107921 106579 -1.2% 1.01x (?)
CharIndexing_punctuated_unicodeScalars_Backwards 116768 113966 -2.4% 1.02x
CharIndexing_russian_unicodeScalars 408873 413297 +1.1% 0.99x (?)
CharIndexing_russian_unicodeScalars_Backwards 442829 432115 -2.4% 1.02x
CharIndexing_tweet_unicodeScalars 977285 949695 -2.8% 1.03x
CharIndexing_tweet_unicodeScalars_Backwards 1051192 1023969 -2.6% 1.03x (?)
CharIndexing_utf16_unicodeScalars 531667 533887 +0.4% 1.00x (?)
CharIndexing_utf16_unicodeScalars_Backwards 580528 576182 -0.7% 1.01x (?)
CharIteration_ascii_unicodeScalars 186519 187359 +0.5% 1.00x
CharIteration_ascii_unicodeScalars_Backwards 328302 329376 +0.3% 1.00x (?)
CharIteration_chinese_unicodeScalars 140895 141591 +0.5% 1.00x (?)
CharIteration_chinese_unicodeScalars_Backwards 251114 246363 -1.9% 1.02x
CharIteration_japanese_unicodeScalars 223553 224735 +0.5% 0.99x (?)
CharIteration_japanese_unicodeScalars_Backwards 404000 392915 -2.7% 1.03x
CharIteration_korean_unicodeScalars 180034 181575 +0.9% 0.99x
CharIteration_korean_unicodeScalars_Backwards 324355 319649 -1.5% 1.01x (?)
CharIteration_punctuatedJapanese_unicodeScalars 33525 33334 -0.6% 1.01x (?)
CharIteration_punctuatedJapanese_unicodeScalars_Backwards 58310 58512 +0.3% 1.00x (?)
CharIteration_punctuated_unicodeScalars 41595 42052 +1.1% 0.99x
CharIteration_punctuated_unicodeScalars_Backwards 73132 74293 +1.6% 0.98x
CharIteration_russian_unicodeScalars 155570 155255 -0.2% 1.00x
CharIteration_russian_unicodeScalars_Backwards 281001 274489 -2.3% 1.02x
CharIteration_tweet_unicodeScalars 372281 371286 -0.3% 1.00x (?)
CharIteration_tweet_unicodeScalars_Backwards 650465 649653 -0.1% 1.00x (?)
CharIteration_utf16_unicodeScalars 204590 203852 -0.4% 1.00x
CharIteration_utf16_unicodeScalars_Backwards 404969 401001 -1.0% 1.01x (?)
CharacterLiteralsLarge 6166 6173 +0.1% 1.00x (?)
CharacterLiteralsSmall 686 688 +0.3% 1.00x
Chars 51238 51628 +0.8% 0.99x
DeadArray 114527 115806 +1.1% 0.99x (?)
Dictionary 3121 3107 -0.4% 1.00x (?)
Dictionary2 3489 3499 +0.3% 1.00x (?)
Dictionary2OfObjects 6035 6074 +0.6% 0.99x (?)
Dictionary3 1332 1325 -0.5% 1.01x (?)
Dictionary3OfObjects 2312 2323 +0.5% 1.00x (?)
DictionaryBridge 2647 2677 +1.1% 0.99x (?)
DictionaryGroup 5459 5526 +1.2% 0.99x (?)
DictionaryGroupOfObjects 8414 8293 -1.4% 1.01x
DictionaryLiteral 8693 8679 -0.2% 1.00x (?)
DictionaryOfObjects 6850 6790 -0.9% 1.01x (?)
DictionaryRemove 21987 21727 -1.2% 1.01x
DictionaryRemoveOfObjects 59366 59534 +0.3% 1.00x (?)
DictionarySwap 5346 5327 -0.4% 1.00x
DictionarySwapOfObjects 23314 23031 -1.2% 1.01x
DropFirstAnyCollection 20578 20568 -0.0% 1.00x (?)
DropFirstAnyCollectionLazy 143558 142598 -0.7% 1.01x (?)
DropFirstAnySeqCRangeIter 31350 31370 +0.1% 1.00x (?)
DropFirstAnySeqCRangeIterLazy 30992 31426 +1.4% 0.99x
DropFirstAnySeqCntRange 20911 20627 -1.4% 1.01x (?)
DropFirstAnySeqCntRangeLazy 20817 20698 -0.6% 1.01x (?)
DropFirstAnySequence 15795 15781 -0.1% 1.00x (?)
DropFirstAnySequenceLazy 15803 15787 -0.1% 1.00x
DropFirstArray 6416 6445 +0.5% 1.00x
DropFirstArrayLazy 44976 44744 -0.5% 1.01x (?)
DropFirstCountableRange 337 340 +0.9% 0.99x
DropFirstCountableRangeLazy 41552 40940 -1.5% 1.01x
DropFirstSequence 14728 14674 -0.4% 1.00x (?)
DropFirstSequenceLazy 14765 14800 +0.2% 1.00x (?)
DropLastAnyCollection 6886 6876 -0.1% 1.00x
DropLastAnyCollectionLazy 47800 47476 -0.7% 1.01x (?)
DropLastAnySeqCRangeIter 48025 49156 +2.4% 0.98x
DropLastAnySeqCRangeIterLazy 48172 48005 -0.3% 1.00x (?)
DropLastAnySeqCntRange 6864 6878 +0.2% 1.00x
DropLastAnySeqCntRangeLazy 6984 6905 -1.1% 1.01x
DropLastAnySequence 33884 34731 +2.5% 0.98x
DropLastAnySequenceLazy 33955 33933 -0.1% 1.00x (?)
DropLastArray 2145 2153 +0.4% 1.00x (?)
DropLastArrayLazy 15004 14914 -0.6% 1.01x
DropLastCountableRange 118 119 +0.8% 0.99x
DropLastCountableRangeLazy 13883 13590 -2.1% 1.02x
DropLastSequence 33473 33504 +0.1% 1.00x (?)
DropLastSequenceLazy 33477 33479 +0.0% 1.00x (?)
DropWhileAnyCollection 27012 26926 -0.3% 1.00x
DropWhileAnyCollectionLazy 29297 29783 +1.7% 0.98x
DropWhileAnySeqCRangeIter 33540 33777 +0.7% 0.99x
DropWhileAnySeqCRangeIterLazy 29204 29755 +1.9% 0.98x
DropWhileAnySeqCntRange 27262 26893 -1.4% 1.01x
DropWhileAnySeqCntRangeLazy 29357 29257 -0.3% 1.00x
DropWhileAnySequence 18696 18718 +0.1% 1.00x (?)
DropWhileAnySequenceLazy 15044 15183 +0.9% 0.99x (?)
DropWhileArray 10302 10157 -1.4% 1.01x
DropWhileArrayLazy 18535 17739 -4.3% 1.04x
DropWhileCountableRange 6582 6564 -0.3% 1.00x (?)
DropWhileCountableRangeLazy 28490 28695 +0.7% 0.99x
DropWhileSequence 17657 17618 -0.2% 1.00x (?)
DropWhileSequenceLazy 13784 13787 +0.0% 1.00x (?)
EqualStringSubstring 679 681 +0.3% 1.00x
EqualSubstringString 677 676 -0.1% 1.00x (?)
EqualSubstringSubstring 790 788 -0.3% 1.00x (?)
EqualSubstringSubstringGenericEquatable 424 421 -0.7% 1.01x
ErrorHandling 6828 6944 +1.7% 0.98x (?)
ExclusivityGlobal 176 174 -1.1% 1.01x
ExclusivityInMatSet 303 303 +0.0% 1.00x
ExclusivityIndependent 123 125 +1.6% 0.98x
FilterEvenUsingReduce 4324 4336 +0.3% 1.00x (?)
FilterEvenUsingReduceInto 2527 2535 +0.3% 1.00x
FrequenciesUsingReduce 15892 15951 +0.4% 1.00x (?)
FrequenciesUsingReduceInto 8853 8965 +1.3% 0.99x (?)
Hanoi 19332 19343 +0.1% 1.00x (?)
HashTest 17284 17328 +0.3% 1.00x
Histogram 8969 8991 +0.2% 1.00x (?)
Integrate 704 679 -3.6% 1.04x
IterateData 13439 13686 +1.8% 0.98x (?)
Join 1520 1530 +0.7% 0.99x
LazilyFilteredArrayContains 5242370 5014990 -4.3% 1.05x
LazilyFilteredArrays 1752265 1757056 +0.3% 1.00x (?)
LazilyFilteredRange 734372 719938 -2.0% 1.02x
LessSubstringSubstring 794 789 -0.6% 1.01x (?)
LessSubstringSubstringGenericComparable 448 442 -1.3% 1.01x
LinkedList 40242 40537 +0.7% 0.99x
MapReduce 39267 39805 +1.4% 0.99x
MapReduceAnyCollection 39289 39268 -0.1% 1.00x (?)
MapReduceAnyCollectionShort 52404 52302 -0.2% 1.00x
MapReduceClass 44441 43981 -1.0% 1.01x
MapReduceClassShort 55656 55649 -0.0% 1.00x (?)
MapReduceLazyCollection 35479 35529 +0.1% 1.00x
MapReduceLazyCollectionShort 46693 46789 +0.2% 1.00x
MapReduceLazySequence 30078 30714 +2.1% 0.98x
MapReduceSequence 45654 46033 +0.8% 0.99x
MapReduceShort 51828 51364 -0.9% 1.01x
MapReduceShortString 286 285 -0.3% 1.00x (?)
MapReduceString 2696 2725 +1.1% 0.99x
Memset 45197 45237 +0.1% 1.00x
MonteCarloE 945664 934935 -1.1% 1.01x
MonteCarloPi 4129485 4100714 -0.7% 1.01x (?)
NSDictionaryCastToSwift 6460 6469 +0.1% 1.00x (?)
NSError 738 745 +0.9% 0.99x
NSStringConversion 383 390 +1.8% 0.98x
NopDeinit 172804 170262 -1.5% 1.01x
ObjectAllocation 1463 1477 +1.0% 0.99x (?)
ObjectiveCBridgeFromNSArrayAnyObject 25392 25127 -1.0% 1.01x (?)
ObjectiveCBridgeFromNSArrayAnyObjectForced 7271 6965 -4.2% 1.04x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToString 41277 41813 +1.3% 0.99x (?)
ObjectiveCBridgeFromNSArrayAnyObjectToStringForced 35498 35215 -0.8% 1.01x (?)
ObjectiveCBridgeFromNSDictionaryAnyObject 123977 126570 +2.1% 0.98x (?)
ObjectiveCBridgeFromNSDictionaryAnyObjectToString 99749 97833 -1.9% 1.02x (?)
ObjectiveCBridgeFromNSSetAnyObject 69104 70142 +1.5% 0.99x (?)
ObjectiveCBridgeFromNSSetAnyObjectForced 7540 7496 -0.6% 1.01x (?)
ObjectiveCBridgeFromNSSetAnyObjectToString 75978 73713 -3.0% 1.03x
ObjectiveCBridgeFromNSSetAnyObjectToStringForced 73681 73704 +0.0% 1.00x (?)
ObjectiveCBridgeFromNSString 3996 4007 +0.3% 1.00x (?)
ObjectiveCBridgeFromNSStringForced 2267 2247 -0.9% 1.01x
ObjectiveCBridgeStubDateAccess 1031 1061 +2.9% 0.97x
ObjectiveCBridgeStubDateMutation 486 486 +0.0% 1.00x
ObjectiveCBridgeStubFromArrayOfNSString 25086 25683 +2.4% 0.98x
ObjectiveCBridgeStubFromNSDate 4128 4011 -2.8% 1.03x
ObjectiveCBridgeStubFromNSDateRef 4434 4413 -0.5% 1.00x
ObjectiveCBridgeStubFromNSString 590 601 +1.9% 0.98x (?)
ObjectiveCBridgeStubFromNSStringRef 176 175 -0.6% 1.01x
ObjectiveCBridgeStubNSDataAppend 2838 2748 -3.2% 1.03x (?)
ObjectiveCBridgeStubNSDateRefAccess 1222 1217 -0.4% 1.00x
ObjectiveCBridgeStubToArrayOfNSString 29555 29648 +0.3% 1.00x (?)
ObjectiveCBridgeStubToNSDateRef 3288 3387 +3.0% 0.97x (?)
ObjectiveCBridgeStubToNSString 1557 1559 +0.1% 1.00x
ObjectiveCBridgeStubToNSStringRef 149 148 -0.7% 1.01x
ObjectiveCBridgeStubURLAppendPath 224489 227854 +1.5% 0.99x
ObjectiveCBridgeStubURLAppendPathRef 223776 224978 +0.5% 0.99x (?)
ObjectiveCBridgeToNSArray 29942 30067 +0.4% 1.00x (?)
ObjectiveCBridgeToNSDictionary 47838 46850 -2.1% 1.02x (?)
ObjectiveCBridgeToNSSet 41069 40813 -0.6% 1.01x (?)
ObjectiveCBridgeToNSString 1319 1307 -0.9% 1.01x (?)
ObserverClosure 6946 7221 +4.0% 0.96x
ObserverForwarderStruct 5121 5096 -0.5% 1.00x (?)
ObserverPartiallyAppliedMethod 8522 8422 -1.2% 1.01x
ObserverUnappliedMethod 8855 8760 -1.1% 1.01x
OpenClose 392 391 -0.3% 1.00x
Phonebook 21607 21185 -2.0% 1.02x
PolymorphicCalls 5151 5180 +0.6% 0.99x
PopFrontArray 10298 10312 +0.1% 1.00x (?)
PopFrontArrayGeneric 9233 9131 -1.1% 1.01x (?)
PopFrontUnsafePointer 6865 6782 -1.2% 1.01x (?)
PrefixAnyCollection 20576 20581 +0.0% 1.00x (?)
PrefixAnyCollectionLazy 142421 141950 -0.3% 1.00x (?)
PrefixAnySeqCRangeIter 24887 24749 -0.6% 1.01x
PrefixAnySeqCRangeIterLazy 25057 24746 -1.2% 1.01x (?)
PrefixAnySeqCntRange 20944 20581 -1.7% 1.02x
PrefixAnySeqCntRangeLazy 20810 20698 -0.5% 1.01x (?)
PrefixAnySequence 12924 12833 -0.7% 1.01x
PrefixAnySequenceLazy 12907 12958 +0.4% 1.00x (?)
PrefixArray 6419 6538 +1.9% 0.98x (?)
PrefixArrayLazy 45083 44718 -0.8% 1.01x (?)
PrefixCountableRange 338 341 +0.9% 0.99x
PrefixCountableRangeLazy 41583 40860 -1.7% 1.02x
PrefixSequence 11769 11952 +1.6% 0.98x
PrefixSequenceLazy 11787 11949 +1.4% 0.99x
PrefixWhileAnyCollection 39225 39543 +0.8% 0.99x (?)
PrefixWhileAnyCollectionLazy 24070 24407 +1.4% 0.99x
PrefixWhileAnySeqCRangeIter 43915 43907 -0.0% 1.00x (?)
PrefixWhileAnySeqCRangeIterLazy 23687 23852 +0.7% 0.99x (?)
PrefixWhileAnySeqCntRange 39585 39031 -1.4% 1.01x
PrefixWhileAnySeqCntRangeLazy 23938 23850 -0.4% 1.00x
PrefixWhileAnySequence 32960 33092 +0.4% 1.00x (?)
PrefixWhileAnySequenceLazy 13417 13426 +0.1% 1.00x (?)
PrefixWhileArray 18177 17573 -3.3% 1.03x
PrefixWhileArrayLazy 16066 15660 -2.5% 1.03x
PrefixWhileCountableRange 18789 18897 +0.6% 0.99x (?)
PrefixWhileCountableRangeLazy 23363 23414 +0.2% 1.00x
PrefixWhileSequence 31964 32049 +0.3% 1.00x
PrefixWhileSequenceLazy 12437 12474 +0.3% 1.00x
Prims 10775 10806 +0.3% 1.00x (?)
PrimsSplit 10740 10800 +0.6% 0.99x (?)
ProtocolDispatch2 499 499 +0.0% 1.00x
RC4 18502 18592 +0.5% 1.00x
RGBHistogram 34367 35349 +2.9% 0.97x (?)
RGBHistogramOfObjects 105951 107363 +1.3% 0.99x
RangeAssignment 5746 5751 +0.1% 1.00x (?)
RangeIterationSigned 18077 17678 -2.2% 1.02x (?)
RangeIterationSigned64 52100 52420 +0.6% 0.99x (?)
RangeIterationUnsigned 47652 48018 +0.8% 0.99x
RecursiveOwnedParameter 11059 11183 +1.1% 0.99x
ReversedArray 46073 44641 -3.1% 1.03x
ReversedBidirectional 76720 76343 -0.5% 1.00x (?)
ReversedDictionary 29875 29780 -0.3% 1.00x
SetExclusiveOr 23024 23099 +0.3% 1.00x (?)
SetExclusiveOr_OfObjects 48594 48324 -0.6% 1.01x
SetIntersect 12569 12551 -0.1% 1.00x
SetIntersect_OfObjects 12607 12593 -0.1% 1.00x (?)
SetIsSubsetOf 1948 1921 -1.4% 1.01x
SetIsSubsetOf_OfObjects 1586 1569 -1.1% 1.01x (?)
SetUnion 11955 11942 -0.1% 1.00x (?)
SetUnion_OfObjects 33666 33658 -0.0% 1.00x (?)
SevenBoom 1684 1665 -1.1% 1.01x (?)
SortLargeExistentials 17388 17325 -0.4% 1.00x (?)
SortLettersInPlace 3071 3077 +0.2% 1.00x (?)
SortSortedStrings 1451 1448 -0.2% 1.00x
SortStrings 2659 2659 +0.0% 1.00x
SortStringsUnicode 9208 9212 +0.0% 1.00x (?)
StackPromo 105884 104967 -0.9% 1.01x (?)
StaticArray 4702 4625 -1.6% 1.02x
StrComplexWalk 6992 6982 -0.1% 1.00x (?)
StrToInt 126420 126506 +0.1% 1.00x (?)
StringAdder 3790 3795 +0.1% 1.00x (?)
StringBuilder 7187 7174 -0.2% 1.00x (?)
StringBuilderLong 1100 1095 -0.5% 1.00x (?)
StringEdits 383042 376082 -1.8% 1.02x (?)
StringEnumRawValueInitialization 12781 12738 -0.3% 1.00x (?)
StringEqualPointerComparison 2605 2521 -3.2% 1.03x
StringFromLongWholeSubstring 216 212 -1.9% 1.02x (?)
StringFromLongWholeSubstringGeneric 213 217 +1.9% 0.98x
StringHasPrefix 1854 1851 -0.2% 1.00x (?)
StringHasPrefixUnicode 16352 16495 +0.9% 0.99x
StringHasSuffix 1875 1831 -2.3% 1.02x
StringHasSuffixUnicode 63531 63585 +0.1% 1.00x (?)
StringInterpolation 13821 13703 -0.9% 1.01x (?)
StringMatch 35043 35001 -0.1% 1.00x (?)
StringUTF16Builder 8021 8093 +0.9% 0.99x (?)
StringWalk 12199 12193 -0.0% 1.00x
StringWithCString 56996 57036 +0.1% 1.00x (?)
SubstringComparable 4329 4322 -0.2% 1.00x (?)
SubstringEqualString 6643 6589 -0.8% 1.01x (?)
SubstringEquatable 8394 8396 +0.0% 1.00x (?)
SubstringFromLongString 17 17 +0.0% 1.00x
SubstringFromLongStringGeneric 115 113 -1.7% 1.02x
SuffixAnyCollection 6873 6881 +0.1% 1.00x
SuffixAnyCollectionLazy 47539 47439 -0.2% 1.00x (?)
SuffixAnySeqCRangeIter 45146 45411 +0.6% 0.99x (?)
SuffixAnySeqCRangeIterLazy 45465 45462 -0.0% 1.00x (?)
SuffixAnySeqCntRange 6871 6874 +0.0% 1.00x
SuffixAnySeqCntRangeLazy 6983 6915 -1.0% 1.01x
SuffixAnySequence 31297 31481 +0.6% 0.99x
SuffixAnySequenceLazy 31313 31369 +0.2% 1.00x (?)
SuffixArray 2149 2190 +1.9% 0.98x
SuffixArrayLazy 15042 14911 -0.9% 1.01x (?)
SuffixCountableRange 118 119 +0.8% 0.99x
SuffixCountableRangeLazy 13903 13573 -2.4% 1.02x
SuffixSequence 30952 30982 +0.1% 1.00x (?)
SuffixSequenceLazy 30951 31014 +0.2% 1.00x (?)
SumUsingReduce 233272 234888 +0.7% 0.99x
SumUsingReduceInto 229498 231388 +0.8% 0.99x (?)
SuperChars 194376 199398 +2.6% 0.97x
TwoSum 4420 4345 -1.7% 1.02x
TypeFlood 167 172 +3.0% 0.97x (?)
UTF8Decode 38679 38678 -0.0% 1.00x (?)
Walsh 12145 12256 +0.9% 0.99x
XorLoop 23596 23598 +0.0% 1.00x (?)
Hardware Overview
  Model Name: Mac mini
  Model Identifier: Macmini7,1
  Processor Name: Intel Core i5
  Processor Speed: 2.8 GHz
  Number of Processors: 1
  Total Number of Cores: 2
  L2 Cache (per Core): 256 KB
  L3 Cache: 3 MB
  Memory: 16 GB

@palimondo
Copy link
Contributor Author

@moiseev I think I've fixed everything. Could you stamp your approval here and merge?

@moiseev
Copy link
Contributor

moiseev commented Oct 13, 2017

@palimondo can you please fix one last thing I just asked for? ;-)

@palimondo
Copy link
Contributor Author

@moiseev Done. Merge worthy?

@gottesmm
Copy link
Contributor

Wait. I would like to review.

Copy link
Contributor

@gottesmm gottesmm left a comment

Choose a reason for hiding this comment

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

This specific commit should be split up into a cleanup commit and the numbering commit and the list commit and then I would like to re-review.

That being said, I have realized that I actively dislike the numbering and do not think we should re-add it because:

  1. It is redundant in the face of being able to invoke singular tests via their name. In fact it is weaker than test names since test names can be used as unique ids over time while these numbers change.
  2. I talked with all of the heavy users on the Swift team and most of them didn't use it or always thought it was a bug.

@@ -181,7 +176,7 @@ struct TestConfig {

// We support specifying multiple tags by splitting on comma, i.e.:
//
// --tags=array,set
// --tags=Array,Dictionary
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of doing this, can you rename the categories to Array so that they are lower case. We should match swift style here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure I follow. The categories seem logical to me at the moment: Capitals for classes, lowercase for descriptive categories. Here I have only updated the comment to correctly reflect the current categories.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather you just in a separate commit, just change the names of Array, Dictionary rather than update the comments.

Copy link
Contributor

Choose a reason for hiding this comment

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

To be clear, the reason why I am against using caps here is that this is against the swift style guide. All enum cases should be camelCased. Why should the benchmark suite do something different from /all/ other swift projects. We should be standard here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree to @palimondo here: The categories which refer to concrete types in the stdlib should be named exactly as those types, everything else with lowercase.
As this is a user-visible name the swift enum case style is of minor interest.

Copy link
Contributor

@gottesmm gottesmm Jul 11, 2018

Choose a reason for hiding this comment

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

Ok. I am fine with dropping this. But just to be clear, I am not saying that the "user-visible" name shouldn't be capitalized. You would do it like this:

enum BenchmarkTag : String {
case array = "Array"
case string = "String"
case cpubench
}

I am just saying that IMO all code in the swift compiler should follow the swift style guide closely because our swift code is often times read as an example code by external developers. Whenever we have diverged in the past, our users have read the code and gotten confused. We are inviting that confusion here.

@palimondo
Copy link
Contributor Author

@gottesmm I don't understand what you mean...

@gottesmm
Copy link
Contributor

@palimondo I reviewed the first commit.

Copy link
Contributor

@gottesmm gottesmm left a comment

Choose a reason for hiding this comment

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

Some more on the first commit.

@@ -80,7 +92,7 @@ public struct BenchmarkInfo {
/// A set of category tags that describe this benchmark. This is used by the
/// harness to allow for easy slicing of the set of benchmarks along tag
/// boundaries, e.x.: run all string benchmarks or ref count benchmarks, etc.
public var tags: [BenchmarkCategory]
public var tags: Set<BenchmarkCategory>
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of using a Set, please us an OptionSet.

@palimondo
Copy link
Contributor Author

palimondo commented Oct 13, 2017

I am using the indexes in my work on improving the robustness of benchmark suite (to eliminate all the sporadic false reports of improvements and regressions). I have a pretty long running branch that depends on that functionality at the moment. I have rebased it on this branch and was hoping to open next PR as soon as this lands. Please have a quick look here.

I have already spent 2 lengthy conflict resolution rebase merges today to accommodate all the above comments from @atrick and @moiseev. Can we please not complicate this any more than is absolutely necessary?

@gottesmm
Copy link
Contributor

I appreciate your side branch, but you are making a lot of changes here, very fast. Can we step back a second and talk about the overall direction things are going on swift-dev?

I would like to understand the overall design that you are following here and we should look to the community for buy-in. Additionally, there are many users of the Benchmark suite who can't fully engage in this discussion via a PR review. A design discussion on swift-dev will let these users engage with the design process without needing to be on during a full on PR review.

@palimondo
Copy link
Contributor Author

That followup PR from capillary-dilation branch includes parasitic re-implementation of most of the Benchmark_Driver functionality in a BenchmarkDriver class that has full unit test coverage… @gottesmm, I was under the impression that was what you wanted to have and I think I have delivered. Isn't that worth it?

@palimondo
Copy link
Contributor Author

palimondo commented Oct 13, 2017

I've started that work on 12 Jun and my main issue is that I'm working too slow. The main branch started to shift from under me with the recent BenchmarkInfo modernization. That's why I'm trying to land my changes before they completely bit-rot.

What should I write to swift-dev about? (I'm mainly unsure how much of the backstory to share...)

Copy link
Collaborator

@xwu xwu left a comment

Choose a reason for hiding this comment

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

Aside from overall direction, just some spelling nits.

* Print a list of available tests matching specified criteria
* `--tags`
* Run tests that are labeled with specified [tags](https://github.com/apple/swift/blob/master/benchmark/utils/TestsUtils.swift#L19)
(coma separated list);
Copy link
Collaborator

Choose a reason for hiding this comment

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

  • "Comma" not "coma"
  • What is the trailing semicolon doing?

* Run tests that are labeled with specified [tags](https://github.com/apple/swift/blob/master/benchmark/utils/TestsUtils.swift#L19)
(coma separated list);
* `--skip-tags`
* Don't run tests that are labeled with specified tags (coma separated
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here

(coma separated list);
* `--skip-tags`
* Don't run tests that are labeled with specified tags (coma separated
list); Default value: `skip,unstable`; To get complete list of tests,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't capitalize after a semicolon

@palimondo
Copy link
Contributor Author

Can I get replies to inline comment in the source?

@palimondo
Copy link
Contributor Author

I don't see the reason to split this into 3 PRs, other than to increase difficulty of contributing. Is that your intention here, @gottesmm?

This PR contains synergistic changes to 4 files (one of them documentation). They restore functionality to previously documented state. It seems you blocked this because you think running by indexes is unused. But I use them. Why isn't that enough?

@palimondo
Copy link
Contributor Author

@gottesmm Or did you really mean splitting commit (not PR), rewriting history? I didn’t know that was even possible — just read about how to do that with interactive rebase. Still, why’s such nitpicking necessary?

@palimondo
Copy link
Contributor Author

@gottesmm Re: what to discuss on swift-dev
You want to discuss this PR or that other branch? I thought that branch… therefore I’m really confused (and frankly, annoyed) by non-communication in this PR.

@gottesmm
Copy link
Contributor

@palimondo I am currently at the LLVM Dev conference for the next day or two (and was for the past day or two), so review is slowing down.

That being said what I am saying is that just you using this feature is not enough. It needs to be able to hold its own weight. There is no reason that you couldn't use just test names and map those locally to whatever index you need in your script.

Lets talk about this more after the LLVM Dev conference is over.

@palimondo
Copy link
Contributor Author

palimondo commented Oct 19, 2017

At the moment, my branch depends on this documented feature, which is why I'm contributing this PR to restore it's accidental removal during introduction of BenchmarkInfo.

In addition to being a convenient shortcut to run tests manually, I'm using it to calibrate the BenchmarkDriver by running Benchmark_O --num-samples=3 --num-iters=1 followed by a list of benchmark indexes. This calibration is equivalent to what Benchmark_O does when running without --num-iters, to get ~1s runtime, but I'm rounding it up to nearest power of 2, to get stable num-iters which is also required to have stable memory usage between runs.

For the time being, I want to continue to use indices as trivial compression scheme, to guard against hitting the command line length limit. At the moment, the 471 benchmark names list is 14332 bytes long. Using indices, this goes down to 1776 (91% savings). I know that full benchmark names list is less then ARG_MAX on Mac OS X: 262144 bytes... still I thought it's good idea to try to keep the command line length down to accommodate future growth in benchmark suite size and ease the future porting efforts.

I believe this is enough for this feature to hold its weight (3 lines of code !!!):

let indices = Dictionary(uniqueKeysWithValues:
  zip(registeredBenchmarks.map{$0.name}, 1...))
…
       benchmarkNamesOrIndices.contains(String(indices[benchmark.name]!))

If and when we move functionality I developed in BenchmarkDriver to Benchmark_X, I have no objection to removing this costly feature...

Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

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

LGTM.
As @gottesmm already noted, there are some changes in the PR which have nothing to do with the PR's description. You did split the changes into multiple commits - that's good. So I'm fine if you just edit the title and description of the PR, e.g. add a list of independent changes.

@@ -181,7 +176,7 @@ struct TestConfig {

// We support specifying multiple tags by splitting on comma, i.e.:
//
// --tags=array,set
// --tags=Array,Dictionary
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree to @palimondo here: The categories which refer to concrete types in the stdlib should be named exactly as those types, everything else with lowercase.
As this is a user-visible name the swift enum case style is of minor interest.

@@ -181,7 +176,7 @@ struct TestConfig {

// We support specifying multiple tags by splitting on comma, i.e.:
//
// --tags=array,set
// --tags=Array,Dictionary
Copy link
Contributor

@gottesmm gottesmm Jul 11, 2018

Choose a reason for hiding this comment

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

Ok. I am fine with dropping this. But just to be clear, I am not saying that the "user-visible" name shouldn't be capitalized. You would do it like this:

enum BenchmarkTag : String {
case array = "Array"
case string = "String"
case cpubench
}

I am just saying that IMO all code in the swift compiler should follow the swift style guide closely because our swift code is often times read as an example code by external developers. Whenever we have diverged in the past, our users have read the code and gotten confused. We are inviting that confusion here.

elapsed_time = sampler.run(test.name, fn: testFn, num_iters: 1)
test.tearDownFunction?()
Copy link
Contributor

Choose a reason for hiding this comment

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

Please do not move this out of the loop. It is important that we have setup/teardown before/after each invocation of the benchmarking function. Benchmark writers should be able to assume that they will have a pristine state when the benchmark starts running. Otherwise, you could have one benchmark iteration affecting another benchmark iteration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this refactoring is safe, because multiple iterations are handled by passing the scale parameter to the sampler.run method, see line 402. This means that setUp and tearDown aren't invoked around every iteration.

Even if you're thinking about a case which measures some kind of a mutable operation (say removing elements from collection), the run function already has to handle the setup of the workload for each iteration. In such a case you'd do the expensive collection building in the setUp, and do a cheaper copy at the beginning of each inner loop, releasing the collection in tearDown. All this implies that the proper names for these functions should be beforeTest and afterTest, but that's for another refactoring.

That's why I think that measuring multiple samples with single setUp and tearDown hoisted outside of the sample loop is safe.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, the setUp/tearDown should be inside the loop

Copy link
Contributor Author

@palimondo palimondo Jul 11, 2018

Choose a reason for hiding this comment

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

@eeckstein The timing of our comments look simultaneous. Did you read my explanation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll move setUp and tearDown invocations inside the numSamples loop to get this in.
But I still think we should rename these to beforeTest and afterTest and move them outside of the loop in a future update.

// REQUIRES: asserts
// REQUIRES: CMAKE_GENERATOR=Ninja

// Integration tests between Benchmark_Driver and Benchmark_O
Copy link
Contributor

Choose a reason for hiding this comment

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

Let me be more specific.

  • If we /do/ want to put the test here, we need to have a "lit" feature that says that benchmarks are available and if this feature is not set, do not run this test. Otherwise, we will try and run this test when the benchmarks are not enabled and the test will fail. So no matter what, we need that.

  • The benchmark's standalone configuration should be able to invoke these tests independently via its cmake. Now I am not saying that this PR is the right place to teach the benchmark's cmake how to do that. Rather I am suggesting that by doing the PR in this way, that becomes more difficult. Instead, we should follow the model of the validation-tests where despite validation-tests not being in the test directory itself, we have taught lit how to delegate to it. The way that this is done can be seen in the file ./test/CMakeLists.txt. I am happy to answer questions/pointers here.

@palimondo
Copy link
Contributor Author

@gottesmm Ever since you offered to help me with my first Swift PR ("Got you covered, man!"), I've considered you a friend. You did a lot to help me understand how I can lend a hand and contribute to the project. But something changed with this PR (and in our following interactions)... First you swept in after two reviewers already gave their thumbs up (back in October 2017) and started asking for procedural changes:

This specific commit should be split up into a cleanup commit and the numbering commit and the list commit and then I would like to re-review.

I'll skip over the details of our resulting interchange, and focus on your most recent input to this PR:

This PR is doing a bunch of things beyond what it claims. I pointed out all the places where this change is doing more than restoring ordinal numbers. Those other changes should be done in a separate PR.

This is after I've, per your original request, completely cleaned up the commit history to offer a fully documented set of minimal commits that implements the stated goal of his PR in my most recent push. While re-implementing the execution by ordinal numbers I had to fix couple of bugs in the immediately surrounding code, that got introduced after the introduction of BenchmarkInfo (effective replacement of --run-all option with --skip-all= parameter, which is required for proper functioning of Benchmark_Driver, which also implements the "run by numbers" functionality). Introducing proper documentation for all this seems like a part of the job to me. (We're both aware you're about to rewrite the docs completely, I'm writing for posterity here.) Same goes for adding lit test coverage for all the fixes I've made. I fix bugs when I see them. I refactor code near the modified parts to improve its clarity. I believe it is my professional duty as a programmer to leave the code I touch in a better state than I started. That's why all these commits are part of this PR.

These escalating requests about previously unstated and undocumented project development procedures come over as quite arbitrary hindrances and I am starting to doubt this is done in the spirit of friendly cooperation. I hope I just got a wrong impression! What is really going on here?

@gottesmm gottesmm dismissed their stale review July 11, 2018 18:09

Giving the review of this to Erik.

@eeckstein
Copy link
Contributor

eeckstein commented Jul 11, 2018

@palimondo There seems to be a misunderstanding. We, including gottesmm, want this PR to land.

But there is one thing which has to be fixed: the test must not run if benchmarks are not built (build-script --skip-build-benchmarks). To do that add a "feature" in lit.site.cfg.in, e.g. "benchmarks", based on the cmake variable SWIFT_BUILD_PERF_TESTSUITE.
And then add a "REQUIRES: benchmarks" line in your test.

The other thing with making the test work in standalone configuration is not that important. You can ignore that for now. We can fix that later.

Does this make sense?

@palimondo palimondo changed the title [benchmark] Restore running benchmarks by ordinal numbers [benchmark] Restore running benchmarks by ordinal numbers and related bugfixes Jul 11, 2018
@palimondo
Copy link
Contributor Author

palimondo commented Jul 11, 2018

@eeckstein I've updated the PR title and description, moved setUp and tearDown back into numSamples loop. I have to push one more time.

Added `lit` substitution for running Benchmark_O binary.
Introduced `lit` tests for `Bechmark_O` to demonstrate bugs:
* listing benchmarks’ tags
* when running with `--num-iters=1`
When listing benchmarks with `--list` parameter, present the tags in format that is actually accepted by the `--tags` and `--skip-tags` parameters.

Changes the `--list` output from
````
Enabled Tests,Tags
AngryPhonebook,[TestsUtils.BenchmarkCategory.validation, TestsUtils.BenchmarkCategory.api, TestsUtils.BenchmarkCategory.String]
...
````
into
````
Enabled Tests,Tags
AngryPhonebook,[String, api, validation]
…
````
Fixed bug where the `elapsed_time` was always 0 when `--num-iters=1` was specified.
Added test: It should be possible to run benchmark by name, even if its tags match the default skip-tags.

Added verification tests for benchmark filtering with `tags` and `skip-tags` parameters.
Also updated benchmark documentation with more detailed description of tag handling.
Fixed failure in `get_tests` which depended on the removed `Benchmark_O --run-all` option for listing all test (not just the pre-commit set).

Fix: Restored the ability to run tests by ordinal number from `Benchmark_Driver` after the support for this was removed from `Benchmark_O`.

Added tests that verify output format of `Benchmark_O --list` and the support for `--skip-tags= ` option which effectively replaced the old `--run-all` option. Other tools, like `Benchmark_Driver` depend on it.
Added integration tests for the dependency between `Benchmark_Driver` and `Benchmark_O`.

Running pre-commit test set isn’t tested explicitly here. It would take too long and it is run fairly frequently by CI bots, so if that breaks, we’ll know soon enough.
Reintroduced feature lost during `BenchmarkInfo` modernization: All registered benchmarks are ordered alphabetically and assigned an index. This number can be used as a shortcut to invoke the test instead of its full name. (Adding and removing tests from the suite will naturally reassign the indices, but they are stable for a given build.)

The `--list` parameter now prints the test *number*, *name* and *tags* separated by delimiter.

The `--list` output format is modified from:
````
Enabled Tests,Tags
AngryPhonebook,[String, api, validation]
...
````
to this:
````
\#,Test,[Tags]
2,AngryPhonebook,[String, api, validation]
…
````
(There isn’t a backslash before the #, git was eating the whole line without it.)
Note: Test number 1 is Ackermann, which is marked as “skip”, so it’s not listed with the default `skip-tags` value.

Fixes the issue where running tests via `Benchmark_Driver` always reported each test as number 1. Each test is run independently, therefore every invocation was “first”. Restoring test numbers resolves this issue back to original state: The number reported in the first column when executing the tests is its ordinal number in the Swift Benchmark Suite.
* Description of listing and running tests by ordinal numbers
@palimondo
Copy link
Contributor Author

@eeckstein I think I have the REQUIRE: benchmark feature in lit down. Please review the commit.

I think I've addressed all the PR comments and this is ready to merge.

@eeckstein
Copy link
Contributor

Thanks. Looks good now.

@eeckstein
Copy link
Contributor

@swift-ci smoke test and merge

1 similar comment
@eeckstein
Copy link
Contributor

@swift-ci smoke test and merge

@swift-ci swift-ci merged commit 90025ca into swiftlang:master Jul 12, 2018
@palimondo
Copy link
Contributor Author

@eeckstein, @gottesmm and other reviewers: Thank you for your help and patience in guiding me through this. Swift’s build and testing infrastructure is extremely complex and very sparsely documented. It seems like most of the know-how is in Apple dev’s heads and there isn’t much externally visible institutional knowledge to draw on. It really helps outside contributor like me, if you can point to concrete files to be modified and mention particular environment variables for dependencies. Vague requirements stated in general terms, though perfectly reasonable for those in the know, are insurmountable obstacles without easy access to you. I wish I could just drop by your computers and ask about the info I’m missing. Being responsive, proactive and caring in your communication is super helpful and fosters the atmosphere of welcoming community. Thank you!

@palimondo palimondo deleted the empathy-test branch July 12, 2018 13:18
@@ -88,6 +88,9 @@ config.available_features.add("CMAKE_GENERATOR=@CMAKE_GENERATOR@")
if "@SWIFT_ENABLE_SOURCEKIT_TESTS@" == "TRUE":
config.available_features.add('sourcekit')

if "@SWIFT_BUILD_PERF_TESTSUITE@" == "TRUE":
config.available_features.add('benchmark')
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm. This broke my local testing, where I usually configure the benchmarks to build (so I have the option) but don't actually always build them. Since check-swift doesn't depend on the benchmark targets, can you make this a dynamic check instead, based on the presence or absence of Benchmark_O?

Copy link
Contributor Author

@palimondo palimondo Jul 20, 2018

Choose a reason for hiding this comment

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

I'm sorry for that! But I'm not sure how to properly fix it. I've added this condition following explicit guidance from @eeckstein. Any pointers for analogous dynamic check?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, well, you're already using inferSwiftBinary to check for the presence of Benchmark_O. Maybe you can see if that came back negative? (meaning, it returned the unqualified Benchmark_O instead of finding the actual executable)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm a bit tick today… so let me walk through this slowly, if I get your meaning:
All these lit.cfg files look like configuration files, but are in fact Python scripts. Which means I can extend that offending if with additional check for config.benchmark_o which carries the result from inferSwiftBinary and I check that it is not just plain 'Benchmark_O'. Correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, basically. I actually think you should drop the current check and instead put one in the regular lit.cfg. IIRC the generated lit.site.cfg gets read very early on and shouldn't be doing much other than checking the configuration options.

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.

8 participants