Skip to content

Commit 0f339d3

Browse files
Merge branch 'master' into safe-conversion
2 parents 2270ac0 + 3f54a46 commit 0f339d3

File tree

397 files changed

+10728
-4104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

397 files changed

+10728
-4104
lines changed

benchmark/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ set(SWIFT_BENCH_MODULES
5858
single-source/ClassArrayGetter
5959
single-source/Codable
6060
single-source/Combos
61-
single-source/CountAlgo
6261
single-source/DataBenchmarks
6362
single-source/DeadArray
6463
single-source/DictOfArraysToArrayOfDicts

benchmark/scripts/run_smoke_bench

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -205,25 +205,6 @@ def test_performance(opt_level, old_dir, new_dir, threshold, num_samples,
205205
threshold * 1.4, output_file, *results)
206206

207207

208-
def get_results(bench_dir, opt_level, num_samples, to_test):
209-
try:
210-
exe = os.path.join(bench_dir, 'bin', 'Benchmark_' + opt_level)
211-
args = [exe, '--num-samples=' + str(num_samples),
212-
'--sample-time=0.0025']
213-
if to_test:
214-
args += to_test
215-
env = {'DYLD_LIBRARY_PATH': os.path.join(bench_dir, 'lib', 'swift',
216-
'macos'),
217-
'SWIFT_DETERMINISTIC_HASHING': '1'}
218-
output = subprocess.check_output(args, env=env)
219-
except subprocess.CalledProcessError as e:
220-
sys.stderr.write(e.output)
221-
sys.stderr.flush()
222-
return sys.exit(e.returncode)
223-
else:
224-
return output
225-
226-
227208
def report_code_size(opt_level, old_dir, new_dir, platform, output_file):
228209
if opt_level == 'swiftlibs':
229210
files = glob.glob(os.path.join(old_dir, 'lib', 'swift', platform,

benchmark/single-source/CountAlgo.swift

Lines changed: 0 additions & 127 deletions
This file was deleted.

benchmark/single-source/DataBenchmarks.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public let DataBenchmarks = [
2020
runFunction: { for _ in 0..<$0*10_000 { blackHole(Data()) } },
2121
tags: d, legacyFactor: 10),
2222
BenchmarkInfo(name: "DataCreateSmall",
23-
runFunction: { for _ in 0..<$0*100 { blackHole(sampleData(.small)) } },
24-
tags: d, legacyFactor: 1000),
23+
runFunction: { for _ in 0..<$0*10_000 { blackHole(sampleData(.small)) } },
24+
tags: d, legacyFactor: 10),
2525
BenchmarkInfo(name: "DataCreateMedium",
2626
runFunction: { for _ in 0..<$0*100 { blackHole(sampleData(.medium)) } },
2727
tags: d, legacyFactor: 100),

benchmark/single-source/Fibonacci.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import TestsUtils
1515
public let Fibonacci = BenchmarkInfo(
1616
name: "Fibonacci",
1717
runFunction: run_Fibonacci,
18-
tags: [.unstable, .algorithm])
18+
tags: [.algorithm])
1919

2020
func fibonacci(_ n: Int) -> Int {
21-
if (n < 2) { return 1 }
21+
if (n <= 2) { return 1 }
2222
return fibonacci(n - 2) + fibonacci(n - 1)
2323
}
2424

@@ -28,14 +28,14 @@ func Fibonacci(_ n: Int) -> Int {
2828
// at compile time.
2929
if False() { return 0 }
3030

31-
if (n < 2) { return 1 }
31+
if (n <= 2) { return 1 }
3232
return fibonacci(n - 2) + fibonacci(n - 1)
3333
}
3434

3535
@inline(never)
3636
public func run_Fibonacci(_ N: Int) {
37-
let n = 32
38-
let ref_result = 3524578
37+
let n = 24
38+
let ref_result = 46368
3939
var result = 0
4040
for _ in 1...N {
4141
result = Fibonacci(n)

benchmark/single-source/FloatingPointPrinting.swift

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,47 +19,56 @@ public let FloatingPointPrinting = [
1919
BenchmarkInfo(
2020
name: "FloatingPointPrinting_Float_description_small",
2121
runFunction: run_FloatingPointPrinting_Float_description_small,
22-
tags: [.validation, .api, .runtime, .String]),
22+
tags: [.validation, .api, .runtime, .String],
23+
legacyFactor: 108),
2324

2425
BenchmarkInfo(
2526
name: "FloatingPointPrinting_Double_description_small",
2627
runFunction: run_FloatingPointPrinting_Double_description_small,
27-
tags: [.validation, .api, .runtime, .String]),
28+
tags: [.validation, .api, .runtime, .String],
29+
legacyFactor: 100),
2830

2931
BenchmarkInfo(
3032
name: "FloatingPointPrinting_Float80_description_small",
3133
runFunction: run_FloatingPointPrinting_Float80_description_small,
32-
tags: [.validation, .api, .runtime, .String]),
34+
tags: [.validation, .api, .runtime, .String],
35+
legacyFactor: 108),
3336

3437
BenchmarkInfo(
3538
name: "FloatingPointPrinting_Float_description_uniform",
3639
runFunction: run_FloatingPointPrinting_Float_description_uniform,
37-
tags: [.validation, .api, .runtime, .String]),
40+
tags: [.validation, .api, .runtime, .String],
41+
legacyFactor: 100),
3842

3943
BenchmarkInfo(
4044
name: "FloatingPointPrinting_Double_description_uniform",
4145
runFunction: run_FloatingPointPrinting_Double_description_uniform,
42-
tags: [.validation, .api, .runtime, .String]),
46+
tags: [.validation, .api, .runtime, .String],
47+
legacyFactor: 100),
4348

4449
BenchmarkInfo(
4550
name: "FloatingPointPrinting_Float80_description_uniform",
4651
runFunction: run_FloatingPointPrinting_Float80_description_uniform,
47-
tags: [.validation, .api, .runtime, .String]),
52+
tags: [.validation, .api, .runtime, .String],
53+
legacyFactor: 100),
4854

4955
BenchmarkInfo(
5056
name: "FloatingPointPrinting_Float_interpolated",
5157
runFunction: run_FloatingPointPrinting_Float_interpolated,
52-
tags: [.validation, .api, .runtime, .String]),
58+
tags: [.validation, .api, .runtime, .String],
59+
legacyFactor: 200),
5360

5461
BenchmarkInfo(
5562
name: "FloatingPointPrinting_Double_interpolated",
5663
runFunction: run_FloatingPointPrinting_Double_interpolated,
57-
tags: [.validation, .api, .runtime, .String]),
64+
tags: [.validation, .api, .runtime, .String],
65+
legacyFactor: 200),
5866

5967
BenchmarkInfo(
6068
name: "FloatingPointPrinting_Float80_interpolated",
6169
runFunction: run_FloatingPointPrinting_Float80_interpolated,
62-
tags: [.validation, .api, .runtime, .String])
70+
tags: [.validation, .api, .runtime, .String],
71+
legacyFactor: 200)
6372
]
6473

6574
// Generate descriptions for 100,000 values around 1.0.
@@ -75,7 +84,7 @@ public let FloatingPointPrinting = [
7584

7685
@inline(never)
7786
public func run_FloatingPointPrinting_Float_description_small(_ N: Int) {
78-
let count = 100_000
87+
let count = 1_000
7988
for _ in 0..<N {
8089
for i in 1...count {
8190
let f = Float(i) / 101.0
@@ -86,7 +95,7 @@ public func run_FloatingPointPrinting_Float_description_small(_ N: Int) {
8695

8796
@inline(never)
8897
public func run_FloatingPointPrinting_Double_description_small(_ N: Int) {
89-
let count = 100_000
98+
let count = 1_000
9099
for _ in 0..<N {
91100
for i in 1...count {
92101
let f = Double(i) / 101.0
@@ -101,7 +110,7 @@ public func run_FloatingPointPrinting_Float80_description_small(_ N: Int) {
101110
// On Darwin, long double is Float80 on x86, and Double otherwise.
102111
// On Linux, Float80 is at aleast available on x86.
103112
#if arch(x86_64) || arch(i386)
104-
let count = 100_000
113+
let count = 1_000
105114
for _ in 0..<N {
106115
for i in 1...count {
107116
let f = Float80(i) / 101.0
@@ -117,7 +126,7 @@ public func run_FloatingPointPrinting_Float80_description_small(_ N: Int) {
117126

118127
@inline(never)
119128
public func run_FloatingPointPrinting_Float_description_uniform(_ N: Int) {
120-
let count = 100_000
129+
let count = 1_000
121130
let step = UInt32.max / UInt32(count)
122131
for _ in 0..<N {
123132
for i in 0..<count {
@@ -130,7 +139,7 @@ public func run_FloatingPointPrinting_Float_description_uniform(_ N: Int) {
130139

131140
@inline(never)
132141
public func run_FloatingPointPrinting_Double_description_uniform(_ N: Int) {
133-
let count = 100_000
142+
let count = 1_000
134143
let step = UInt64.max / UInt64(count)
135144
for _ in 0..<N {
136145
for i in 0..<count {
@@ -147,7 +156,7 @@ public func run_FloatingPointPrinting_Float80_description_uniform(_ N: Int) {
147156
// On Darwin, long double is Float80 on x86, and Double otherwise.
148157
// On Linux, Float80 is at aleast available on x86.
149158
#if arch(x86_64) || arch(i386)
150-
let count = 100_000
159+
let count = 1_000
151160
let step = UInt64.max / UInt64(count)
152161
for _ in 0..<N {
153162
for i in 0..<count {
@@ -167,7 +176,7 @@ public func run_FloatingPointPrinting_Float80_description_uniform(_ N: Int) {
167176

168177
@inline(never)
169178
public func run_FloatingPointPrinting_Float_interpolated(_ N: Int) {
170-
let count = 100_000
179+
let count = 500
171180
let step = UInt32.max / UInt32(count)
172181
for _ in 0..<N {
173182
for i in 0..<count {
@@ -180,7 +189,7 @@ public func run_FloatingPointPrinting_Float_interpolated(_ N: Int) {
180189

181190
@inline(never)
182191
public func run_FloatingPointPrinting_Double_interpolated(_ N: Int) {
183-
let count = 100_000
192+
let count = 500
184193
let step = UInt64.max / UInt64(count)
185194
for _ in 0..<N {
186195
for i in 0..<count {
@@ -197,7 +206,7 @@ public func run_FloatingPointPrinting_Float80_interpolated(_ N: Int) {
197206
// On Darwin, long double is Float80 on x86, and Double otherwise.
198207
// On Linux, Float80 is at aleast available on x86.
199208
#if arch(x86_64) || arch(i386)
200-
let count = 100_000
209+
let count = 500
201210
let step = UInt64.max / UInt64(count)
202211
for _ in 0..<N {
203212
for i in 0..<count {
@@ -210,4 +219,3 @@ public func run_FloatingPointPrinting_Float80_interpolated(_ N: Int) {
210219
#endif // x86
211220
#endif // Darwin/Linux
212221
}
213-

0 commit comments

Comments
 (0)