Skip to content

Commit 4b1af1d

Browse files
Draft: optimizations
1 parent 04dedd9 commit 4b1af1d

File tree

16 files changed

+690
-371
lines changed

16 files changed

+690
-371
lines changed

utbot-framework-test/src/benchmarks/kotlin/org/utbot/benchmarks/BenchmarksTest.kt renamed to utbot-framework-test/src/benchmarks/kotlin/org/utbot/benchmarks/Benchmark.kt

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import org.utbot.framework.UtSettings
1414
import org.utbot.framework.plugin.api.MockStrategyApi
1515
import org.utbot.framework.plugin.api.util.UtContext
1616
import org.utbot.framework.plugin.api.util.executableId
17-
import org.utbot.framework.plugin.api.util.withUtContext
1817
import org.utbot.framework.plugin.services.JdkInfoDefaultProvider
1918
import org.utbot.framework.util.SootUtils
2019
import org.utbot.tests.infrastructure.TestSpecificTestCaseGenerator
@@ -23,9 +22,9 @@ import java.util.concurrent.TimeUnit
2322
@State(Scope.Benchmark)
2423
@Fork(1)
2524
@Threads(1)
26-
@Warmup(iterations = 2)
25+
@Warmup(iterations = 1)
2726
@Measurement(iterations = 4, timeUnit = TimeUnit.SECONDS)
28-
class BenchmarksTest {
27+
class Benchmark {
2928
lateinit var testCaseGenerator: TestSpecificTestCaseGenerator
3029
lateinit var context: UtContext
3130

@@ -51,52 +50,42 @@ class BenchmarksTest {
5150

5251
@Benchmark
5352
fun benchmarkLongMethod() {
54-
withUtContext(context) {
55-
testCaseGenerator.generate(
56-
Benchmarks::longMethod.executableId,
57-
MockStrategyApi.NO_MOCKS
58-
)
59-
}
53+
testCaseGenerator.generate(
54+
Benchmarks::longMethod.executableId,
55+
MockStrategyApi.NO_MOCKS
56+
)
6057
}
6158

6259

6360
@Benchmark
6461
fun benchmarkCycle() {
65-
withUtContext(context) {
66-
testCaseGenerator.generate(
67-
Benchmarks::cycle.executableId,
68-
MockStrategyApi.NO_MOCKS
69-
)
70-
}
62+
testCaseGenerator.generate(
63+
Benchmarks::cycle.executableId,
64+
MockStrategyApi.NO_MOCKS
65+
)
7166
}
7267

7368
@Benchmark
7469
fun benchmarkExceptionInToString() {
75-
withUtContext(context) {
76-
testCaseGenerator.generate(
77-
StringConcat::exceptionInToString.executableId,
78-
MockStrategyApi.NO_MOCKS
79-
)
80-
}
70+
testCaseGenerator.generate(
71+
StringConcat::exceptionInToString.executableId,
72+
MockStrategyApi.NO_MOCKS
73+
)
8174
}
8275

8376
@Benchmark
8477
fun benchmarkPutAndGet() {
85-
withUtContext(context) {
86-
testCaseGenerator.generate(
87-
Benchmarks::mapPutAndGet.executableId,
88-
MockStrategyApi.NO_MOCKS
89-
)
90-
}
78+
testCaseGenerator.generate(
79+
Benchmarks::mapPutAndGet.executableId,
80+
MockStrategyApi.NO_MOCKS
81+
)
9182
}
9283

9384
@Benchmark
9485
fun benchmarkPutInMapFromParameters() {
95-
withUtContext(context) {
96-
testCaseGenerator.generate(
97-
Benchmarks::putInMapFromParameters.executableId,
98-
MockStrategyApi.NO_MOCKS
99-
)
100-
}
86+
testCaseGenerator.generate(
87+
Benchmarks::putInMapFromParameters.executableId,
88+
MockStrategyApi.NO_MOCKS
89+
)
10190
}
10291
}

utbot-framework-test/src/benchmarks/kotlin/org/utbot/benchmarks/ProfilerTest.kt

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,33 @@ fun main() {
2020
)
2121

2222
UtSettings.utBotGenerationTimeoutInMillis = 200_000
23+
UtSettings.useFuzzing = false
24+
UtSettings.useConcreteExecution = false
2325

2426

25-
repeat(2) {
26-
testCaseGenerator.generate(
27-
listOf(
28-
Benchmarks::cycle.executableId
29-
),
30-
mockStrategy = MockStrategyApi.NO_MOCKS,
31-
generate = { engine -> engine.traverse() }
32-
)
27+
testCaseGenerator.generate(
28+
Benchmarks::longMethod.executableId,
29+
mockStrategy = MockStrategyApi.NO_MOCKS,
30+
)
31+
32+
33+
repeat(20) {
3334
testCaseGenerator.generate(
34-
listOf(
35-
Benchmarks::longMethod.executableId
36-
),
37-
mockStrategy = MockStrategyApi.NO_MOCKS,
38-
generate = { engine -> engine.traverse() }
35+
Benchmarks::cycle.executableId,
36+
mockStrategy = MockStrategyApi.NO_MOCKS
3937
)
4038
}
39+
// repeat(10) {
40+
// testCaseGenerator.generate(
41+
// Benchmarks::longMethod.executableId,
42+
// mockStrategy = MockStrategyApi.NO_MOCKS
43+
// )
44+
// }
45+
// repeat(2) {
46+
// testCaseGenerator.generate(
47+
// Benchmarks::putInMapFromParameters.executableId,
48+
// MockStrategyApi.NO_MOCKS
49+
// )
50+
// }
4151
}
4252
}

0 commit comments

Comments
 (0)