Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
os: [ubuntu-latest]
jvm: [17,19]
benchmark: [BindingsBenchmarks, TransferBenchmarks]
jit: [NoJIT, Standard]
jit: [disabled, standard]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand All @@ -21,7 +21,7 @@ jobs:
with:
jvm: temurin:1.${{ matrix.jvm }}
apps: mill
- 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 }}.*
- 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 }}.*
- 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
- uses: actions/upload-artifact@v3
with:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package fr.hammons.slinc

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

case class A(a: Int, b: B, c: Int)
case class B(a: Int, b: Int)
case class A(a: Int, b: B, c: Int) derives Struct
case class B(a: Int, b: Int) derives Struct

@Warmup(iterations = 5)
@Measurement(iterations = 5)
trait TransferBenchmarkShape(val s: Slinc):
import s.{given, *}

case class C(a: Int, b: D, c: Int)
case class D(a: Int, b: Int)
given Struct[A] = Struct.derived
given Struct[B] = Struct.derived
given Struct[C] = Struct.derived
given Struct[D] = Struct.derived
case class C(a: Int, b: D, c: Int) derives Struct
case class D(a: CLong, b: Int) derives Struct
case class E(a: Int, b: Int) derives Struct
case class F(a: Int, e: E, c: Int) derives Struct

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

val c = C(1, D(2, 3), 4)
val c = C(1, D(CLong(2), 3), 4)

@Benchmark
def topLevelRead =
Expand All @@ -50,7 +51,37 @@ trait TransferBenchmarkShape(val s: Slinc):
)

@Benchmark
def allocateIntPointer =
def allocatePrimitivePointer =
Scope.confined(
Ptr.copy(3)
)

@Benchmark
def allocateAliasPointer =
Scope.confined(
Ptr.copy(CLong(3))
)

@Benchmark
def allocateComplexWAliasInnerStructPointer =
Scope.confined(
Ptr.copy(C(1, D(CLong(2), 3), 4))
)

@Benchmark
def allocateSimpleWAliasInnerStructPointer =
Scope.confined(
Ptr.copy(D(CLong(2), 3))
)

@Benchmark
def allocatePtrFromArray =
Scope.confined(
Ptr.copy(Array(1, 2, 3))
)

@Benchmark
def allocatePtrFromCLongArray =
Scope.confined(
Ptr.copy(Array(CLong(1), CLong(2), CLong(3)))
)
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ import java.util.concurrent.TimeUnit
)
)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
class BindingsBenchmarksNoJIT extends BindingsBenchmarkShape(Slinc17.noJit)
class BindingsBenchmarks17 extends BindingsBenchmarkShape(Slinc17.noJit)

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ import java.util.concurrent.TimeUnit
)
)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
class TransferBenchmarksNoJIT extends TransferBenchmarkShape(Slinc17.noJit)
class TransferBenchmarks17 extends TransferBenchmarkShape(Slinc17.noJit)

This file was deleted.

2 changes: 0 additions & 2 deletions j17/src/fr/hammons/slinc/Slinc17.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class Slinc17(using

@SlincImpl(17)
object Slinc17:
private lazy val compiler =
scala.quoted.staging.Compiler.make(getClass().getClassLoader().nn)
private[slinc] lazy val linker = CLinker.getInstance().nn
val default = Slinc17()
val noJit = Slinc17()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ import java.util.concurrent.TimeUnit
)
)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
class TransferBenchmarksNoJIT extends TransferBenchmarkShape(Slinc19.noJit)
class BindingsBenchmarks19 extends BindingsBenchmarkShape(Slinc19.noJit)

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ import java.util.concurrent.TimeUnit
)
)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
class BindingsBenchmarksNoJIT extends BindingsBenchmarkShape(Slinc19.noJit)
class TransferBenchmarks19 extends TransferBenchmarkShape(Slinc19.noJit)

This file was deleted.