Commit Graph

291 Commits

Author SHA1 Message Date
Erik Eckstein
ee9ad6f0da benchmarks: mark more benchmarks as unstable 2017-12-15 16:57:31 -08:00
swift-ci
ff679109da Merge pull request #13371 from lancep/long_shared_prefix 2017-12-13 11:52:33 -08:00
Erik Eckstein
0133bfd71f benchmarks: identify more unstable benchmarks 2017-12-12 12:35:22 -08:00
Lance Parker
b446659934 Use blackHole on the comparison result 2017-12-12 10:43:25 -08:00
Lance Parker
4ed54512d0 added benchmark for strings with long shared prefixes 2017-12-11 17:35:36 -08:00
Max Moiseev
ea02806f28 [stdlib] Conditional conformances for LazyFilterCollection
(cherry picked from commit 833721a172)
2017-12-11 10:46:25 -08:00
Graydon Hoare
62a6b74ad1 Revert "[stdlib] Conditional conformances for Lazy[Filter|Map]Collection" 2017-12-10 12:48:36 -08:00
Max Moiseev
833721a172 [stdlib] Conditional conformances for LazyFilterCollection 2017-12-08 12:52:12 -08:00
Ben Cohen
4ddac3fbbd [stdlib] Eradicate IndexDistance associated type (#12641)
* Eradicate IndexDistance associated type, replacing with Int everywhere

* Consistently use Int for ExistentialCollection’s IndexDistance type.

* Fix test for IndexDistance removal

* Remove a handful of no-longer-needed explicit types

* Add compatibility shims for non-Int index distances

* Test compatibility shim

* Move IndexDistance typealias into the Collection protocol
2017-12-08 12:00:23 -08:00
Erik Eckstein
614c12a1d8 benchmarks: mark another benchmark as unstable 2017-12-05 09:23:19 -08:00
Erik Eckstein
9931b3c719 benchmarks: Mark some unstable benchmarks as unstable.
Which excludes them from the list of executed benchmarks.
2017-12-04 16:01:56 -08:00
Karoy Lorentey
9fef06e59c Merge pull request #12752 from hamishknight/dictionary-subscript-addressor
[stdlib] Use addressor for Dictionary's subscript(_:default:)
2017-12-04 15:04:29 +01:00
Lance Parker
4cad7535b7 Added comparison benchmarks
# Conflicts:
#	benchmark/single-source/StringComparison.swift
2017-12-01 16:54:08 -08:00
Erik Eckstein
a940cdeafb benchmarks: Rename 2 benchmarks which were fixed recently.
So that we don't compare with the (wrong) baseline
2017-11-30 15:29:29 -08:00
Hamish
f7015c2984 [stdlib] Added benchmarks for Dictionary's subscript(_:default:) 2017-11-19 15:45:27 +00:00
Karoy Lorentey
c6a4d1131e Make sure string benchmarks actually measure string operations
The optimizer was sometimes able to eliminate most/all of the actual operations, so some benchmarks were not really measuring anything.
2017-11-08 19:15:47 +00:00
Max Moiseev
c6ff6b0142 Extract setup and teardown stages for a benchmnark 2017-10-12 15:26:38 -07:00
Max Moiseev
b5492518ae [benchmark] Add LazilyFilteredArrayContains benchmark 2017-10-12 11:36:57 -07:00
Max Moiseev
5db258b5ab Merge pull request #12196 from moiseev/bench-no-characters
[benchmark] Eliminate usages of String.characters and CharacterView
2017-10-06 17:05:14 -07:00
Max Moiseev
53ec0b1168 Improve StringEdits performance in absence of CharacterView
CharacterView was not Hashable, so Set could not be used as an
accumulator. String and Substring are Hashable, but using a Set as an
accumulator is still slower than first collecting all the results in an
Array and then transforming it to a Set at the end. One possible reason
why that could be the case, is that by the time conversion happens, we
already know the capacity and thus will not re-allocate and re-hash a
Set on every insertion beyong current capacity.
2017-10-05 10:43:08 -07:00
Max Moiseev
f7f7d25c06 Go back to using Array in StringEdits benchmark 2017-10-04 15:50:34 -07:00
Max Moiseev
d88493a7a2 Apply changes to a gyb file instead of a generated result 2017-10-04 15:50:34 -07:00
Max Moiseev
ff105c5ab2 [benchmark] Eliminate usages of String.characters and CharacterView
To avoid compiler warnings.
<rdar://problem/34750654>
2017-10-04 15:50:34 -07:00
Max Moiseev
26c498c005 [benchmark] Add RangeIteration benchmarks 2017-10-04 14:50:29 -07:00
Max Moiseev
1dd9d61ded Move all benchmarks to use registerBenchmark and BenchmarkInfo 2017-10-03 18:04:56 -07:00
Andrew Trick
3560ad2203 Register AnyHashableWithAClass benchmark. 2017-09-22 21:25:46 -07:00
Andrew Trick
e7edd270e5 Register PolymorphicCalls benchmark. 2017-09-22 21:11:30 -07:00
Andrew Trick
a6dcdfda29 Register SevenBoom benchmark. 2017-09-22 21:06:51 -07:00
Andrew Trick
d38e8da6a2 Register the LinkedList benchmark. 2017-09-22 20:51:46 -07:00
Andrew Trick
c0ffc0d451 Register the Exclusivity benchmark. 2017-09-22 20:43:23 -07:00
Andrew Trick
78b072b4da Add a CPU microbenchmarks for isUniquelyReferenced. 2017-09-22 16:38:49 -07:00
Andrew Trick
2e60052d1d ObjectAllocation is a .cpubench. 2017-09-22 14:52:47 -07:00
Andrew Trick
d9af4c5f45 Introduce BenchmarkInfo and BenchmarkCategories. 2017-09-22 12:49:59 -07:00
Erik Eckstein
d6f6774214 benchmarks: add a benchmark for string enum construction from a string raw value. 2017-09-18 17:50:24 -07:00
Erik Eckstein
9e432294e1 benchmarks: fix warnings
rdar://problem/33660902
2017-08-01 17:47:16 -07:00
Dave Abrahams
31341e6753 Merge pull request #10976 from d-ronnqvist/reduce-with-inout
[stdlib] Implement SE-0171: Reduce with inout
2017-07-23 19:57:25 -07:00
David Rönnqvist
bc235afcf8 [stdlib] Update reduce benchmark to compare the two forms
The ReduceInto benchmark performs three tasks using both `reduce(_:_)` and `reduce(into:_:)` so that their performance can be compared:

1. Summing an array, reducing to `Int`
2. Filtering an array, reducing to `[Int]`
3. Counting letter frequencies, reducing to `[Character: Int]`
2017-07-18 17:42:27 +02:00
Erik Eckstein
ffa38bbf84 Revert "Add benchmarks for a number of NSStringAPI functions"
This reverts commit cf73e560ad.

The benchmarks are causing leaks.
Reverted until this is investigated.
2017-07-17 17:38:49 -07:00
David Rönnqvist
e15ea5fcf3 [stdlib] Implement reduce with inout (SE-0171)
Implement and document `reduce(into:_:)`, with a few notes:

 - The `initial` parameter was renamed `initialResult` to match the first parameter in `reduce(_:_:)`.
 - The unnamed `combining` parameter was renamed `updateAccumulatingResult` to try and resemble the naming of the closure parameter in `reduce(_:_:)`.
 - The closure throws and `reduce(into:_)` re-throws.
 - This documentation mentions that `reduce(into:_)` is preferred over `reduce(_:_:)` when the result is a copy-on-write type and an example where the result is a dictionary.

Add benchmarks for reduce with accumulation into a scalar, an array, and a dictionary.

Update expected error message in closures test (since there are now two `reduce` methods, the diagnostic is different).
2017-07-14 23:24:42 +02:00
Philippe Hausler
cf73e560ad Add benchmarks for a number of NSStringAPI functions 2017-07-13 11:33:35 -07:00
Andrew Trick
b76794ce2b Benchmarks for memory exclusivity enforcement.
Three blind microbenchmarks:
- global access
- materializeForSet class property
- nested independent access
2017-06-29 14:31:46 -07:00
Michael Ilseman
bd5189c25a [String] Grapheme fast paths for punctuation: 5-8x speedup.
Many strings use non-sub-300 punctuation characters (e.g. unicode
hyphen, CJK quotes, etc). This can cause switching between fast and
slow paths for grapheme breaking. Add in fast-paths for general
punctuation characters and CJK punctuation and symbol characters.

This results in about a 5-8x speedup for heavily (unicode) punctuated
Latiny and CJKy workloads.
2017-06-27 19:18:51 -07:00
Dave Abrahams
cb4c656bc2 [stdlib] Add benchmarks for Character's unicodeScalars view
In local testing, these benchmark results change as follows due to f212fac717:

<details open>
  <summary>Regression (20)</summary>

TEST                                              | OLD    | NEW    | DELTA   | SPEEDUP
---                                               | ---    | ---    | ---     | ---
CharIteration_utf16_unicodeScalars                | 33074  | 79510  | +140.4% | **0.42x**
CharIteration_utf16_unicodeScalars_Backwards      | 73826  | 115515 | +56.5%  | **0.64x**

</details>

<details open>
  <summary>Improvement (43)</summary>

TEST                                              | OLD    | NEW    | DELTA   | SPEEDUP
---                                               | ---    | ---    | ---     | ---
CharIndexing_korean_unicodeScalars                | 118425 | 10360  | -91.3%  | **11.43x**
CharIndexing_tweet_unicodeScalars_Backwards       | 226366 | 19850  | -91.2%  | **11.40x**
CharIndexing_tweet_unicodeScalars                 | 240596 | 21178  | -91.2%  | **11.36x**
CharIndexing_japanese_unicodeScalars_Backwards    | 136265 | 12032  | -91.2%  | **11.33x**
CharIndexing_chinese_unicodeScalars               | 92226  | 8146   | -91.2%  | **11.32x**
CharIndexing_russian_unicodeScalars               | 100908 | 8948   | -91.1%  | **11.28x**
CharIndexing_japanese_unicodeScalars              | 145414 | 12895  | -91.1%  | **11.28x**
CharIndexing_ascii_unicodeScalars                 | 121438 | 10779  | -91.1%  | **11.27x**
CharIndexing_russian_unicodeScalars_Backwards     | 94190  | 8367   | -91.1%  | **11.26x**
CharIndexing_korean_unicodeScalars_Backwards      | 110175 | 9803   | -91.1%  | **11.24x**
CharIndexing_chinese_unicodeScalars_Backwards     | 86479  | 7715   | -91.1%  | **11.21x**
CharIndexing_ascii_unicodeScalars_Backwards       | 113255 | 10132  | -91.1%  | **11.18x**
CharIteration_ascii_unicodeScalars_Backwards      | 114873 | 13701  | -88.1%  | **8.38x**
CharIteration_chinese_unicodeScalars_Backwards    | 85778  | 10411  | -87.9%  | **8.24x**
CharIteration_russian_unicodeScalars_Backwards    | 94504  | 11471  | -87.9%  | **8.24x**
CharIteration_japanese_unicodeScalars_Backwards   | 136231 | 16569  | -87.8%  | **8.22x**
CharIteration_tweet_unicodeScalars_Backwards      | 222907 | 27165  | -87.8%  | **8.21x**
CharIteration_korean_unicodeScalars_Backwards     | 110132 | 13443  | -87.8%  | **8.19x**
CharIteration_korean_unicodeScalars               | 79540  | 11859  | -85.1%  | **6.71x**
CharIteration_russian_unicodeScalars              | 68209  | 10211  | -85.0%  | **6.68x**
CharIteration_japanese_unicodeScalars             | 98016  | 14690  | -85.0%  | **6.67x**
CharIteration_tweet_unicodeScalars                | 161177 | 24227  | -85.0%  | **6.65x**
CharIteration_chinese_unicodeScalars              | 61702  | 9278   | -85.0%  | **6.65x**
CharIteration_ascii_unicodeScalars                | 81049  | 12218  | -84.9%  | **6.63x**

</details>
2017-06-27 17:25:41 -07:00
Erik Eckstein
2c0b69d241 benchmarks: Make sure there is no constant propagation in the StringBuilder benchmarks.
This fixes the StringAdder benchmark, where the string addition was completely constant folded.
It has only minimal effect on the other benchmarks in this file, because the optimizer didn't constant fold the strings there anyway.
2017-06-21 17:21:51 -07:00
swift-ci
42649b36b0 Merge pull request #10468 from eeckstein/convert-benchmark 2017-06-21 17:10:35 -07:00
Erik Eckstein
f45bddcaa6 benchmarks: Convert the GlobalClass benchmark to a SILOptimizer test
The purpose of the benchmark was to check a very specific ARC optimization, which is better tested with a lit test.
Beside that, the benchmark was broken anyway.
2017-06-21 14:32:29 -07:00
Erik Eckstein
e7360897d2 benchmarks: fix ByteSwap benchmark
*) Use getInt to prevent loop hoisting of the benchmark functions
*) Reduce the overhead of CheckResult by moving it out of the loop
*) Prevent inlining of the actual benchmark functions
2017-06-21 13:37:20 -07:00
Erik Eckstein
8abe785300 benchmarks: Fix the BitCount benchmark
*) Increase the iteration count, so that we cat a time value > 100 for better accuracy
*) Use getInt to prevent constant propgation and loop hoisting
2017-06-19 20:30:20 -07:00
Nate Cook
ced26b8565 [benchmark] Fix the Dictionary(group:by:) test
When testing quadratic behavior, remember to repeat small amounts of the
behavior several times, not to increase the N, which is squared. 🙄
2017-06-16 18:33:15 -05:00
Nate Cook
220614c016 [benchmark] Add benchmark for Dictionary(group:by:) 2017-06-15 11:45:33 -05:00