Skip to content

Commit 9bfd833

Browse files
committed
chore: update benchmarks
1 parent 8e2ad0c commit 9bfd833

File tree

11 files changed

+47
-82
lines changed

11 files changed

+47
-82
lines changed

.github/workflows/benchmarks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
os: [ubuntu-latest]
1313
jvm: [17,19]
1414
benchmark: [BindingsBenchmarks, TransferBenchmarks]
15-
jit: [NoJIT, Standard]
15+
jit: [disabled, standard]
1616
runs-on: ${{ matrix.os }}
1717
steps:
1818
- uses: actions/checkout@v3
@@ -21,7 +21,7 @@ jobs:
2121
with:
2222
jvm: temurin:1.${{ matrix.jvm }}
2323
apps: mill
24-
- run: mill j${{ matrix.jvm }}.benchmarks.test -f1 -wi 2 -i 2 -o j${{ matrix.jvm }}-${{ matrix.os }}.bench -rff j${{ matrix.jvm }}-${{ matrix.os }}.json -rf json .*${{ matrix.benchmark }}${{ matrix.jit }}.*
24+
- run: mill j${{ matrix.jvm }}.benchmarks.test -jvmArgsAppend "-Dslinc.jitc.mode=${{ matrix.jit }}" -f1 -wi 2 -i 2 -o j${{ matrix.jvm }}-${{ matrix.os }}.bench -rff j${{ matrix.jvm }}-${{ matrix.os }}.json -rf json .*${{ matrix.benchmark }}${{ matrix.jvm }}.*
2525
- run: scala-cli run scripts/PublishBenchmarkReport.sc -- "Java ${{ matrix.jvm}}" ${{ matrix.os }} out/j${{ matrix.jvm }}/benchmarks/test/jmhRun.dest/j${{ matrix.jvm }}-${{ matrix.os }}.json ${{ matrix.benchmark }} ${{ matrix.jit }} >> $GITHUB_STEP_SUMMARY
2626
- uses: actions/upload-artifact@v3
2727
with:

core/benchmarks/test/src/fr/hammons/slinc/TransferBenchmarkShape.scala

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
package fr.hammons.slinc
22

3+
import fr.hammons.slinc.types.CLong
34
import org.openjdk.jmh.annotations.{Scope as _, *}
45

5-
case class A(a: Int, b: B, c: Int)
6-
case class B(a: Int, b: Int)
6+
case class A(a: Int, b: B, c: Int) derives Struct
7+
case class B(a: Int, b: Int) derives Struct
78

9+
@Warmup(iterations = 5)
10+
@Measurement(iterations = 5)
811
trait TransferBenchmarkShape(val s: Slinc):
912
import s.{given, *}
1013

11-
case class C(a: Int, b: D, c: Int)
12-
case class D(a: Int, b: Int)
13-
given Struct[A] = Struct.derived
14-
given Struct[B] = Struct.derived
15-
given Struct[C] = Struct.derived
16-
given Struct[D] = Struct.derived
14+
case class C(a: Int, b: D, c: Int) derives Struct
15+
case class D(a: CLong, b: Int) derives Struct
16+
case class E(a: Int, b: Int) derives Struct
17+
case class F(a: Int, e: E, c: Int) derives Struct
1718

1819
val aPtr = Scope.global {
1920
Ptr.blank[A]
@@ -25,7 +26,7 @@ trait TransferBenchmarkShape(val s: Slinc):
2526
Ptr.blank[C]
2627
}
2728

28-
val c = C(1, D(2, 3), 4)
29+
val c = C(1, D(CLong(2), 3), 4)
2930

3031
@Benchmark
3132
def topLevelRead =
@@ -50,7 +51,37 @@ trait TransferBenchmarkShape(val s: Slinc):
5051
)
5152

5253
@Benchmark
53-
def allocateIntPointer =
54+
def allocatePrimitivePointer =
5455
Scope.confined(
5556
Ptr.copy(3)
5657
)
58+
59+
@Benchmark
60+
def allocateAliasPointer =
61+
Scope.confined(
62+
Ptr.copy(CLong(3))
63+
)
64+
65+
@Benchmark
66+
def allocateComplexWAliasInnerStructPointer =
67+
Scope.confined(
68+
Ptr.copy(C(1, D(CLong(2), 3), 4))
69+
)
70+
71+
@Benchmark
72+
def allocateSimpleWAliasInnerStructPointer =
73+
Scope.confined(
74+
Ptr.copy(D(CLong(2), 3))
75+
)
76+
77+
@Benchmark
78+
def allocatePtrFromArray =
79+
Scope.confined(
80+
Ptr.copy(Array(1, 2, 3))
81+
)
82+
83+
@Benchmark
84+
def allocatePtrFromCLongArray =
85+
Scope.confined(
86+
Ptr.copy(Array(CLong(1), CLong(2), CLong(3)))
87+
)

j17/benchmarks/test/src/fr/hammons/slinc/BindingsBenchmarksNoJIT.scala renamed to j17/benchmarks/test/src/fr/hammons/slinc/BindingsBenchmarks17.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ import java.util.concurrent.TimeUnit
1313
)
1414
)
1515
@OutputTimeUnit(TimeUnit.MICROSECONDS)
16-
class BindingsBenchmarksNoJIT extends BindingsBenchmarkShape(Slinc17.noJit)
16+
class BindingsBenchmarks17 extends BindingsBenchmarkShape(Slinc17.noJit)

j17/benchmarks/test/src/fr/hammons/slinc/BindingsBenchmarksStandard.scala

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

j17/benchmarks/test/src/fr/hammons/slinc/TransferBenchmarksNoJIT.scala renamed to j17/benchmarks/test/src/fr/hammons/slinc/TransferBenchmarks17.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ import java.util.concurrent.TimeUnit
1313
)
1414
)
1515
@OutputTimeUnit(TimeUnit.MICROSECONDS)
16-
class TransferBenchmarksNoJIT extends TransferBenchmarkShape(Slinc17.noJit)
16+
class TransferBenchmarks17 extends TransferBenchmarkShape(Slinc17.noJit)

j17/benchmarks/test/src/fr/hammons/slinc/TransferBenchmarksStandard.scala

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

j17/src/fr/hammons/slinc/Slinc17.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ class Slinc17(using
2020

2121
@SlincImpl(17)
2222
object Slinc17:
23-
private lazy val compiler =
24-
scala.quoted.staging.Compiler.make(getClass().getClassLoader().nn)
2523
private[slinc] lazy val linker = CLinker.getInstance().nn
2624
val default = Slinc17()
2725
val noJit = Slinc17()

j19/benchmarks/test/src/fr/hammons/slinc/TransferBenchmarksNoJIT.scala renamed to j19/benchmarks/test/src/fr/hammons/slinc/BindingsBenchmarks19.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ import java.util.concurrent.TimeUnit
1313
)
1414
)
1515
@OutputTimeUnit(TimeUnit.MICROSECONDS)
16-
class TransferBenchmarksNoJIT extends TransferBenchmarkShape(Slinc19.noJit)
16+
class BindingsBenchmarks19 extends BindingsBenchmarkShape(Slinc19.noJit)

j19/benchmarks/test/src/fr/hammons/slinc/BindingsBenchmarksStandard.scala

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

j19/benchmarks/test/src/fr/hammons/slinc/BindingsBenchmarksNoJIT.scala renamed to j19/benchmarks/test/src/fr/hammons/slinc/TransferBenchmarks19.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ import java.util.concurrent.TimeUnit
1313
)
1414
)
1515
@OutputTimeUnit(TimeUnit.MICROSECONDS)
16-
class BindingsBenchmarksNoJIT extends BindingsBenchmarkShape(Slinc19.noJit)
16+
class TransferBenchmarks19 extends TransferBenchmarkShape(Slinc19.noJit)

0 commit comments

Comments
 (0)