Skip to content

Commit 3659f06

Browse files
authored
Ensure there's a benchmark with only native types (#2673)
1 parent 56ae42c commit 3659f06

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

fixtures/benchmarks/benches/bindings/run_benchmarks.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ class TestCallbackObj : TestCallbackInterface {
1717
}
1818

1919
override fun runTest(testCase: TestCase, count: ULong): ULong {
20-
val data = TestData("StringOne", "StringTwo")
2120
return when (testCase) {
2221
TestCase.FUNCTION -> measureNanoTime {
22+
val data = TestData("StringOne", "StringTwo")
2323
for (i in 0UL..count) {
2424
testFunction(10, 20, data)
2525
}
2626
}
2727
TestCase.VOID_RETURN -> measureNanoTime {
2828
for (i in 0UL..count) {
29-
testVoidReturn(10, 20, data)
29+
testVoidReturn(10, 20)
3030
}
3131
}
3232
TestCase.NO_ARGS_VOID_RETURN -> measureNanoTime {

fixtures/benchmarks/benches/bindings/run_benchmarks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ def method_with_no_args_and_void_return(self):
1616
pass
1717

1818
def run_test(self, test_case, count):
19-
data = TestData(foo="StringOne", bar="StringTwo")
2019
if test_case == TestCase.FUNCTION:
20+
data = TestData(foo="StringOne", bar="StringTwo")
2121
start = time.perf_counter_ns()
2222
for i in range(count):
2323
test_function(10, 20, data)
2424
elif test_case == TestCase.VOID_RETURN:
2525
start = time.perf_counter_ns()
2626
for i in range(count):
27-
test_void_return(10, 20, data)
27+
test_void_return(10, 20)
2828
elif test_case == TestCase.NO_ARGS_VOID_RETURN:
2929
start = time.perf_counter_ns()
3030
for i in range(count):

fixtures/benchmarks/benches/bindings/run_benchmarks.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ class TestCallbackObj: TestCallbackInterface {
2424
}
2525

2626
func runTest(testCase: TestCase, count: UInt64) -> UInt64 {
27-
let data = TestData(foo: "StringOne", bar: "StringTwo")
2827
let start: clock_t
2928
switch testCase {
3029
case TestCase.function:
30+
let data = TestData(foo: "StringOne", bar: "StringTwo")
3131
start = clock()
3232
for _ in 0...count {
3333
testFunction(a: 10, b: 20, data: data)
3434
}
3535
case TestCase.voidReturn:
3636
start = clock()
3737
for _ in 0...count {
38-
testVoidReturn(a: 10, b: 20, data: data)
38+
testVoidReturn(a: 10, b: 20)
3939
}
4040

4141
case TestCase.noArgsVoidReturn:

fixtures/benchmarks/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ pub fn test_function(_a: i32, _b: i32, data: TestData) -> String {
4646
}
4747

4848
#[uniffi::export]
49-
pub fn test_void_return(_a: i32, _b: i32, _data: TestData) {}
49+
pub fn test_void_return(_a: i32, _b: i32) {}
50+
5051
#[uniffi::export]
5152
pub fn test_no_args_void_return() {}
5253

0 commit comments

Comments
 (0)