Skip to content

Commit fa3ff89

Browse files
authored
Spelling benchmark (#42457)
* spelling: approximate Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: available Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: benchmarks Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: between Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: calculation Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: characterization Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: coefficient Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: computation Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: deterministic Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: divisor Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: encounter Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: expected Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: fibonacci Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: fulfill Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: implements Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: into Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: intrinsic Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: markdown Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: measure Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: occurrences Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: omitted Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: partition Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: performance Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: practice Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: preemptive Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: repeated Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: requirements Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: requires Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: response Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: supports Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: unknown Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: utilities Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: verbose Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
1 parent e8b5204 commit fa3ff89

15 files changed

+35
-35
lines changed

Diff for: benchmark/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ set(SWIFT_BENCHMARK_EXTRA_FLAGS "" CACHE STRING
241241
"Extra options to pass to swiftc when building the benchmarks")
242242

243243
set(SWIFT_BENCHMARK_UNOPTIMIZED_DRIVER NO CACHE BOOL
244-
"Build the benchmark driver utilites without optimization (default: no)")
244+
"Build the benchmark driver utilities without optimization (default: no)")
245245

246246
if (SWIFT_BENCHMARK_BUILT_STANDALONE)
247247
# This option's value must match the value of the same option used when

Diff for: benchmark/scripts/Benchmark_Driver

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Example:
2020
2121
Use `Benchmark_Driver -h` for help on available commands and options.
2222
23-
class `BenchmarkDriver` runs performance tests and impements the `run` COMMAND.
23+
class `BenchmarkDriver` runs performance tests and implements the `run` COMMAND.
2424
class `BenchmarkDoctor` analyzes performance tests, implements `check` COMMAND.
2525
2626
"""
@@ -544,7 +544,7 @@ class BenchmarkDoctor(object):
544544
caveat = "" if setup == 0 else " (excluding the setup overhead)"
545545
log("'%s' execution took at least %d μs%s.", name, runtime, caveat)
546546

547-
def factor(base): # suitable divisior that's integer power of base
547+
def factor(base): # suitable divisor that's integer power of base
548548
return int(
549549
pow(base, math.ceil(math.log(runtime / float(threshold), base)))
550550
)
@@ -718,7 +718,7 @@ class BenchmarkDoctor(object):
718718
return measurements
719719

720720
def analyze(self, benchmark_measurements):
721-
"""Analyze whether benchmark fullfills all requirtements."""
721+
"""Analyze whether benchmark fulfills all requirements."""
722722
self.log.debug("Analyzing %s", benchmark_measurements["name"])
723723
for rule in self.requirements:
724724
rule(benchmark_measurements)

Diff for: benchmark/scripts/compare_perf_tests.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class `PerformanceTestSamples` is collection of `Sample`s and their statistics.
2222
class `PerformanceTestResult` is a summary of performance test execution.
2323
class `LogParser` converts log files into `PerformanceTestResult`s.
2424
class `ResultComparison` compares new and old `PerformanceTestResult`s.
25-
class `TestComparator` analyzes changes betweeen the old and new test results.
25+
class `TestComparator` analyzes changes between the old and new test results.
2626
class `ReportFormatter` creates the test comparison report in specified format.
2727
2828
"""
@@ -111,7 +111,7 @@ def exclude_outliers(self, top_only=False):
111111
112112
Experimentally, this rule seems to perform well-enough on the
113113
benchmark runtimes in the microbenchmark range to filter out
114-
the environment noise caused by preemtive multitasking.
114+
the environment noise caused by preemptive multitasking.
115115
"""
116116
lo = (
117117
0
@@ -205,7 +205,7 @@ def running_mean_variance(stats, x):
205205

206206
@property
207207
def cv(self):
208-
"""Coeficient of Variation (%)."""
208+
"""Coefficient of Variation (%)."""
209209
return (self.sd / self.mean) if self.mean else 0
210210

211211
@property
@@ -225,7 +225,7 @@ class PerformanceTestResult(object):
225225
Reported by the test driver (Benchmark_O, Benchmark_Onone, Benchmark_Osize
226226
or Benchmark_Driver).
227227
228-
It suppors 2 log formats emitted by the test driver. Legacy format with
228+
It supports 2 log formats emitted by the test driver. Legacy format with
229229
statistics for normal distribution (MEAN, SD):
230230
#,TEST,SAMPLES,MIN(μs),MAX(μs),MEAN(μs),SD(μs),MEDIAN(μs),MAX_RSS(B)
231231
And new quantiles format with variable number of columns:
@@ -311,7 +311,7 @@ def merge(self, r):
311311
"""Merge two results.
312312
313313
Recomputes min, max and mean statistics. If all `samples` are
314-
avaliable, it recomputes all the statistics.
314+
available, it recomputes all the statistics.
315315
The use case here is comparing test results parsed from concatenated
316316
log files from multiple runs of benchmark driver.
317317
"""
@@ -514,12 +514,12 @@ def results_from_file(log_file):
514514

515515

516516
class TestComparator(object):
517-
"""Analyzes changes betweeen the old and new test results.
517+
"""Analyzes changes between the old and new test results.
518518
519519
It determines which tests were `added`, `removed` and which can be
520520
compared. It then splits the `ResultComparison`s into 3 groups according to
521521
the `delta_threshold` by the change in performance: `increased`,
522-
`descreased` and `unchanged`. Whole computaion is performed during
522+
`descreased` and `unchanged`. Whole computation is performed during
523523
initialization and results are provided as properties on this object.
524524
525525
The lists of `added`, `removed` and `unchanged` tests are sorted
@@ -576,7 +576,7 @@ def partition(items, p):
576576

577577

578578
class ReportFormatter(object):
579-
"""Creates the report from perfromance test comparison in specified format.
579+
"""Creates the report from performance test comparison in specified format.
580580
581581
`ReportFormatter` formats the `PerformanceTestResult`s and
582582
`ResultComparison`s provided by `TestComparator` into report table.

Diff for: benchmark/scripts/run_smoke_bench

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#
1616
# Performs a very fast check which benchmarks regressed and improved.
1717
#
18-
# Initially runs the benchmars with a low sample count and just re-runs those
18+
# Initially runs the benchmarks with a low sample count and just re-runs those
1919
# benchmarks which differ.
2020
# Also reports code size differences.
2121
#
@@ -224,7 +224,7 @@ def measure(driver, tests, i):
224224

225225

226226
def merge(results, other_results):
227-
""""Merge the other PreformanceTestResults into the first dictionary."""
227+
""""Merge the other PerformanceTestResults into the first dictionary."""
228228
for test, result in other_results.items():
229229
results[test].merge(result)
230230
return results

Diff for: benchmark/scripts/test_Benchmark_Driver.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,12 @@ def test_output_dir(self):
135135
self.assertIsNone(parse_args(["run"]).output_dir)
136136
self.assertEqual(parse_args(["run", "--output-dir", "/log"]).output_dir, "/log")
137137

138-
def test_check_supports_vebose_output(self):
138+
def test_check_supports_verbose_output(self):
139139
self.assertFalse(parse_args(["check"]).verbose)
140140
self.assertTrue(parse_args(["check", "-v"]).verbose)
141141
self.assertTrue(parse_args(["check", "--verbose"]).verbose)
142142

143-
def test_check_supports_mardown_output(self):
143+
def test_check_supports_markdown_output(self):
144144
self.assertFalse(parse_args(["check"]).markdown)
145145
self.assertTrue(parse_args(["check", "-md"]).markdown)
146146
self.assertTrue(parse_args(["check", "--markdown"]).markdown)
@@ -486,7 +486,7 @@ def assert_log_written(out, log_file, content):
486486

487487
shutil.rmtree(temp_dir)
488488

489-
def test_deterministing_hashing(self):
489+
def test_deterministic_hashing(self):
490490
cmd = ["printenv", "SWIFT_DETERMINISTIC_HASHING"]
491491
driver = BenchmarkDriver(["no args"], tests=["ignored"])
492492
self.assertEqual(driver._invoke(cmd).strip(), "1")
@@ -839,7 +839,7 @@ def test_benchmark_runtime_range(self):
839839
quantum used by macos scheduler. Linux scheduler's quantum is 6ms.
840840
Driver yielding the process before the 10ms quantum elapses helped
841841
a lot, but benchmarks with runtimes under 1ms usually exhibit a strong
842-
mode which is best for accurate performance charaterization.
842+
mode which is best for accurate performance characterization.
843843
To minimize the number of involuntary context switches that corrupt our
844844
measurements, we should strive to stay in the microbenchmark range.
845845
@@ -999,7 +999,7 @@ def test_benchmark_has_constant_memory_use(self):
999999
doctor.analyze(
10001000
{
10011001
# The threshold of 15 pages was estimated from previous
1002-
# measurements. The normal range should be probably aproximated
1002+
# measurements. The normal range should be probably approximate
10031003
# by a function instead of a simple constant.
10041004
# TODO: re-evaluate normal range from whole SBS
10051005
"name": "ConstantMemory",

Diff for: benchmark/scripts/test_compare_perf_tests.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def test_init_quantiles(self):
247247
def test_init_delta_quantiles(self):
248248
# #,TEST,SAMPLES,MIN(μs),𝚫MEDIAN,𝚫MAX
249249
# 2-quantile from 2 samples in repeated min, when delta encoded,
250-
# the difference is 0, which is ommited -- only separator remains
250+
# the difference is 0, which is omitted -- only separator remains
251251
log = "202,DropWhileArray,2,265,,22"
252252
r = PerformanceTestResult(log.split(","), quantiles=True, delta=True)
253253
self.assertEqual((r.num_samples, r.min, r.median, r.max), (2, 265, 265, 287))
@@ -257,7 +257,7 @@ def test_init_delta_quantiles(self):
257257
def test_init_oversampled_quantiles(self):
258258
"""When num_samples is < quantile + 1, some of the measurements are
259259
repeated in the report summary. Samples should contain only true
260-
values, discarding the repetated artifacts from quantile estimation.
260+
values, discarding the repeated artifacts from quantile estimation.
261261
262262
The test string is slightly massaged output of the following R script:
263263
subsample <- function(x, q) {
@@ -517,7 +517,7 @@ def assert_report_contains(self, texts, report):
517517

518518
class TestLogParser(unittest.TestCase):
519519
def test_parse_results_csv(self):
520-
"""Ignores uknown lines, extracts data from supported formats."""
520+
"""Ignores unknown lines, extracts data from supported formats."""
521521
log = """#,TEST,SAMPLES,MIN(us),MAX(us),MEAN(us),SD(us),MEDIAN(us)
522522
7,Array.append.Array.Int?,20,10,10,10,0,10
523523
21,Bridging.NSArray.as!.Array.NSString,20,11,11,11,0,11

Diff for: benchmark/scripts/test_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def __init__(self, responses=None):
6969
def expect(self, call_args, response):
7070
"""Expect invocation of tested method with given arguments.
7171
72-
Stores the canned reponse in the `respond` dictionary.
72+
Stores the canned response in the `respond` dictionary.
7373
"""
7474
call_args = tuple(call_args)
7575
self.expected.append(call_args)
@@ -83,7 +83,7 @@ def assert_called_with(self, expected_args):
8383
)
8484

8585
def assert_called_all_expected(self):
86-
"""Verify that all expeced invocations of tested method were called."""
86+
"""Verify that all expected invocations of tested method were called."""
8787
assert self.calls == self.expected, "\nExpected: {0}, \n Called: {1}".format(
8888
self.expected, self.calls
8989
)

Diff for: benchmark/single-source/Breadcrumbs.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ class UTF16ToIdxRange: BenchmarkBase {
323323
}
324324

325325
/// Split a string into `count` random slices and convert their index ranges
326-
/// into into UTF-16 offset pairs.
326+
/// into UTF-16 offset pairs.
327327
class IdxToUTF16Range: BenchmarkBase {
328328
let count: Int
329329
var inputIndices: [Range<String.Index>] = []

Diff for: benchmark/single-source/LuhnAlgoEager.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ extension MapSomeSequenceView: Sequence {
7272
}
7373

7474
// now extend a lazy collection to return that view
75-
// from a call to mapSome. In pracice, when doing this,
75+
// from a call to mapSome. In practice, when doing this,
7676
// you should do it for all the lazy wrappers
7777
// (i.e. random-access, forward and sequence)
7878
extension LazyCollectionProtocol {

Diff for: benchmark/single-source/LuhnAlgoLazy.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ extension MapSomeSequenceView: Sequence {
7272
}
7373

7474
// now extend a lazy collection to return that view
75-
// from a call to mapSome. In pracice, when doing this,
75+
// from a call to mapSome. In practice, when doing this,
7676
// you should do it for all the lazy wrappers
7777
// (i.e. random-access, forward and sequence)
7878
extension LazyCollectionProtocol {
@@ -219,7 +219,7 @@ let combineDoubleDigits = {
219219
(10...18).contains($0) ? $0-9 : $0
220220
}
221221

222-
// first, the lazy version of checksum calcuation
222+
// first, the lazy version of checksum calculation
223223
let lazychecksum = { (ccnum: String) -> Bool in
224224
ccnum.lazy
225225
|> reverse

Diff for: benchmark/single-source/SIMDReduceInteger.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public func run_SIMDReduceInt32x4_init(_ n: Int) {
120120
@inline(never)
121121
public func run_SIMDReduceInt32x4_cast(_ n: Int) {
122122
// Morally it seems like we "should" be able to use withMemoryRebound
123-
// to SIMD4<Int32>, but that function requries that the sizes match in
123+
// to SIMD4<Int32>, but that function requires that the sizes match in
124124
// debug builds, so this is pretty ugly. The following "works" for now,
125125
// but is probably in violation of the formal model (the exact rules
126126
// for "assumingMemoryBound" are not clearly documented). We need a

Diff for: benchmark/single-source/SortArrayInClass.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// See https://swift.org/LICENSE.txt for license information
99
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1010
//
11-
// This benchmark is derived from user code that encoutered a major
11+
// This benchmark is derived from user code that encountered a major
1212
// performance problem in normal usage. Contributed by Saleem
1313
// Abdulrasool (compnerd).
1414
//

Diff for: benchmark/single-source/SortIntPyramids.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import TestsUtils
22

3-
// This benchmark aims to measuare heapSort path of stdlib sorting function.
3+
// This benchmark aims to measure heapSort path of stdlib sorting function.
44
// Datasets in this benchmark are influenced by stdlib partition function,
5-
// therefore if stdlib partion implementation changes we should correct these
5+
// therefore if stdlib partition implementation changes we should correct these
66
// datasets or disable/skip this benchmark
77
public let benchmarks = [
88
BenchmarkInfo(

Diff for: benchmark/single-source/WordCount.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public func run_WordCountUniqueUTF16(_ n: Int) {
245245
}
246246

247247
/// Returns an array of all words in the supplied string, along with their
248-
/// number of occurances. The array is sorted by decreasing frequency.
248+
/// number of occurrences. The array is sorted by decreasing frequency.
249249
/// (Words are case-sensitive and only support a limited subset of Unicode.)
250250
@inline(never)
251251
func histogram<S: Sequence>(for words: S) -> [(String, Int)]

Diff for: benchmark/utils/TestsUtils.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public enum BenchmarkCategory : String {
3131
case exclusivity, differentiation
3232

3333
// Algorithms are "micro" that test some well-known algorithm in isolation:
34-
// sorting, searching, hashing, fibonaci, crypto, etc.
34+
// sorting, searching, hashing, fibonacci, crypto, etc.
3535
case algorithm
3636

3737
// Miniapplications are contrived to mimic some subset of application behavior
@@ -55,7 +55,7 @@ public enum BenchmarkCategory : String {
5555
// counterproductive.
5656
case unstable
5757

58-
// CPU benchmarks represent instrinsic Swift performance. They are useful for
58+
// CPU benchmarks represent intrinsic Swift performance. They are useful for
5959
// measuring a fully baked Swift implementation across different platforms and
6060
// hardware. The benchmark should also be reasonably applicable to real Swift
6161
// code--it should exercise a known performance critical area. Typically these

0 commit comments

Comments
 (0)