-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
7,980 additions
and
381 deletions.
There are no files selected for viewing
908 changes: 908 additions & 0 deletions
908
modules/benchmark_3/src/main/scala/benchmark/record4s_arrayrecord/CompileConcatenation.scala
Large diffs are not rendered by default.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
modules/benchmark_3/src/main/scala/benchmark/record4s_arrayrecord/CompileCreation.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package benchmark | ||
package record4s_arrayrecord | ||
|
||
import java.util.concurrent.TimeUnit; | ||
import org.openjdk.jmh.annotations.* | ||
|
||
@BenchmarkMode(Array(Mode.SingleShotTime)) | ||
@OutputTimeUnit(TimeUnit.SECONDS) | ||
@State(Scope.Thread) | ||
class CompileCreation { | ||
@Param(Array("1", "50", "100", "150", "200", "250")) | ||
var size: Int = 0 | ||
|
||
var source: String = "" | ||
|
||
var compiler: Compiler = null | ||
|
||
@Setup(Level.Iteration) | ||
def setup(): Unit = { | ||
compiler = new Compiler | ||
|
||
val fields = (1 to size).map(i => s"f${i} = ${i}").mkString(",") | ||
source = s""" | ||
|import com.github.tarao.record4s.ArrayRecord | ||
|object A { | ||
| val r = ArrayRecord(${fields}) | ||
|} | ||
|""".stripMargin | ||
} | ||
|
||
@Benchmark | ||
def create_fN = | ||
compiler.compile(source) | ||
} |
36 changes: 36 additions & 0 deletions
36
.../benchmark_3/src/main/scala/benchmark/record4s_arrayrecord/CompileCreationAndAccess.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package benchmark | ||
package record4s_arrayrecord | ||
|
||
import java.util.concurrent.TimeUnit; | ||
import org.openjdk.jmh.annotations.* | ||
|
||
@BenchmarkMode(Array(Mode.SingleShotTime)) | ||
@OutputTimeUnit(TimeUnit.SECONDS) | ||
@State(Scope.Thread) | ||
class CompileCreationAndAccess { | ||
@Param(Array("1", "50", "100", "150", "200", "250")) | ||
var size: Int = 0 | ||
|
||
var source: String = "" | ||
|
||
var compiler: Compiler = null | ||
|
||
@Setup(Level.Iteration) | ||
def setup(): Unit = { | ||
compiler = new Compiler | ||
|
||
val fields = (1 to size).map(i => s"f${i} = ${i}").mkString(",") | ||
val access = (1 to size).map(i => s" r.f${i}").mkString("\n") | ||
source = s""" | ||
|import com.github.tarao.record4s.ArrayRecord | ||
|object A { | ||
| val r = ArrayRecord(${fields}) | ||
|${access} | ||
|} | ||
|""".stripMargin | ||
} | ||
|
||
@Benchmark | ||
def create_fN = | ||
compiler.compile(source) | ||
} |
38 changes: 38 additions & 0 deletions
38
...nchmark_3/src/main/scala/benchmark/record4s_arrayrecord/CompileCreationAndAccessRep.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package benchmark | ||
package record4s_arrayrecord | ||
|
||
import java.util.concurrent.TimeUnit; | ||
import org.openjdk.jmh.annotations.* | ||
|
||
@BenchmarkMode(Array(Mode.SingleShotTime)) | ||
@OutputTimeUnit(TimeUnit.SECONDS) | ||
@State(Scope.Thread) | ||
class CompileCreationAndAccessRep { | ||
val repetitions = 10 | ||
|
||
@Param(Array("1", "50", "100", "150", "200", "250")) | ||
var size: Int = 0 | ||
|
||
var source: String = "" | ||
|
||
var compiler: Compiler = null | ||
|
||
@Setup(Level.Iteration) | ||
def setup(): Unit = { | ||
compiler = new Compiler | ||
|
||
val fields = (1 to size).map(i => s"f${i} = ${i}").mkString(",") | ||
val access = (1 to repetitions).map(_ => s" r.f${size}").mkString("\n") | ||
source = s""" | ||
|import com.github.tarao.record4s.ArrayRecord | ||
|object A { | ||
| val r = ArrayRecord(${fields}) | ||
|${access} | ||
|} | ||
|""".stripMargin | ||
} | ||
|
||
@Benchmark | ||
def create_fN = | ||
compiler.compile(source) | ||
} |
72 changes: 72 additions & 0 deletions
72
modules/benchmark_3/src/main/scala/benchmark/record4s_arrayrecord/CompileFieldAccess.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package benchmark | ||
package record4s_arrayrecord | ||
|
||
import java.util.concurrent.TimeUnit; | ||
import org.openjdk.jmh.annotations.* | ||
|
||
import com.github.tarao.record4s.ArrayRecord | ||
|
||
@BenchmarkMode(Array(Mode.SingleShotTime)) | ||
@OutputTimeUnit(TimeUnit.SECONDS) | ||
@State(Scope.Thread) | ||
class CompileFieldAccess { | ||
@Param(Array("1", "2", "4", "8", "10", "12", "14", "16", "18", "20", "22", "24", "26", "28", "30", "32")) | ||
var index: Int = 0 | ||
|
||
var source: String = "" | ||
|
||
var compiler: Compiler = null | ||
|
||
@Setup(Level.Iteration) | ||
def setup(): Unit = { | ||
compiler = new Compiler | ||
|
||
source = s""" | ||
|import benchmark.record4s_arrayrecord.CompileFieldAccess.r | ||
|object A { | ||
| r.f${index} | ||
|} | ||
|""".stripMargin | ||
} | ||
|
||
@Benchmark | ||
def access_fN = | ||
compiler.compile(source) | ||
} | ||
|
||
object CompileFieldAccess { | ||
val r = ArrayRecord( | ||
f1 = 1, | ||
f2 = 2, | ||
f3 = 3, | ||
f4 = 4, | ||
f5 = 5, | ||
f6 = 6, | ||
f7 = 7, | ||
f8 = 8, | ||
f9 = 9, | ||
f10 = 10, | ||
f11 = 11, | ||
f12 = 12, | ||
f13 = 13, | ||
f14 = 14, | ||
f15 = 15, | ||
f16 = 16, | ||
f17 = 17, | ||
f18 = 18, | ||
f19 = 19, | ||
f20 = 20, | ||
f21 = 21, | ||
f22 = 22, | ||
f23 = 23, | ||
f24 = 24, | ||
f25 = 25, | ||
f26 = 26, | ||
f27 = 27, | ||
f28 = 28, | ||
f29 = 29, | ||
f30 = 30, | ||
f31 = 31, | ||
f32 = 32, | ||
) | ||
} |
Oops, something went wrong.