Skip to content

Commit 2ec19ec

Browse files
committed
Benchmarks: Skip long benchmarks in -Onone build
1 parent 6942742 commit 2ec19ec

File tree

5 files changed

+27
-3
lines changed

5 files changed

+27
-3
lines changed

benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,10 @@ function (swift_benchmark_compile_archopts)
363363
list(APPEND common_options "-g")
364364
endif()
365365

366+
if("${optflag}" STREQUAL "Onone")
367+
list(APPEND common_options "-DDEBUG")
368+
endif()
369+
366370
if (is_darwin)
367371
list(APPEND common_options
368372
"-I" "${srcdir}/utils/ObjectiveCTests"
@@ -400,6 +404,10 @@ function (swift_benchmark_compile_archopts)
400404
"-target" "${target}"
401405
"-${driver_opt}")
402406

407+
if(${optflag} STREQUAL "Onone")
408+
list(APPEND common_options_driver "-DDEBUG")
409+
endif()
410+
403411
if(SWIFT_BENCHMARK_GENERATE_DEBUG_INFO)
404412
list(APPEND common_options_driver "-g")
405413
endif()

benchmark/multi-source/Monoids/Benchmark.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public let benchmarks = [
55
BenchmarkInfo(
66
name: "Monoids",
77
runFunction: run_Monoids,
8-
tags: [.algorithm])
8+
tags: [.algorithm, .miniapplication, .long])
99
]
1010

1111
func run_Monoids(_ n: Int) {

benchmark/scripts/build_script_helper.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,15 @@ def perform_build(args, swiftbuild_path, config, binary_name, opt_flag):
2525
"-Xswiftc",
2626
"-align-module-to-page-size",
2727
"-Xswiftc",
28-
opt_flag,
28+
opt_flag
2929
]
30+
31+
if config == "debug":
32+
swiftbuild_args += [
33+
"-Xswiftc",
34+
"-DDEBUG"
35+
]
36+
3037
if args.verbose:
3138
swiftbuild_args.append("--verbose")
3239
subprocess.call(swiftbuild_args)

benchmark/utils/DriverUtils.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,16 @@ struct TestConfig {
198198
action = c.action ?? .run
199199
allowNondeterministicHashing = c.allowNondeterministicHashing ?? false
200200
jsonOutput = c.jsonOutput ?? false
201+
202+
var skipTags: Set<BenchmarkCategory>
203+
skipTags = c.tags ?? [.unstable, .skip]
204+
#if DEBUG
205+
skipTags.insert(.long)
206+
#endif
201207
tests = TestConfig.filterTests(registeredBenchmarks,
202208
tests: c.tests ?? [],
203209
tags: c.tags ?? [],
204-
skipTags: c.skipTags ?? [.unstable, .skip])
210+
skipTags: skipTags)
205211

206212
if tests.count > 0 {
207213
testNameLength = tests.map{$0.info.name.count}.sorted().reversed().first!

benchmark/utils/TestsUtils.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ public enum BenchmarkCategory : String {
6969
// significant optimization.
7070
case cpubench
7171

72+
// Benchmarks to skip on -Onone runs.
73+
case long
74+
7275
// Explicit skip marker
7376
case skip
7477
}

0 commit comments

Comments
 (0)