Skip to content

Commit

Permalink
Use uninitialized instead of _ in lazyval benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
mbovel committed Aug 29, 2024
1 parent e9e046d commit 85b1c0e
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dotty.tools.benchmarks.lazyvals

import compiletime.uninitialized
import org.openjdk.jmh.annotations._
import LazyVals.LazyHolder
import org.openjdk.jmh.infra.Blackhole
Expand All @@ -16,12 +17,12 @@ import java.util.concurrent.{Executors, ExecutorService}
class ContendedInitialization {

@Param(Array("2000000", "5000000"))
var size: Int = _
var size: Int = uninitialized

@Param(Array("2", "4", "8"))
var nThreads: Int = _
var nThreads: Int = uninitialized

var executor: ExecutorService = _
var executor: ExecutorService = uninitialized

@Setup
def prepare: Unit = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dotty.tools.benchmarks.lazyvals

import compiletime.uninitialized
import org.openjdk.jmh.annotations._
import LazyVals.LazyHolder
import org.openjdk.jmh.infra.Blackhole
Expand All @@ -14,7 +15,7 @@ import java.util.concurrent.TimeUnit
@State(Scope.Benchmark)
class InitializedAccess {

var holder: LazyHolder = _
var holder: LazyHolder = uninitialized

@Setup
def prepare: Unit = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dotty.tools.benchmarks.lazyvals

import compiletime.uninitialized
import org.openjdk.jmh.annotations._
import LazyVals.LazyAnyHolder
import org.openjdk.jmh.infra.Blackhole
Expand All @@ -14,7 +15,7 @@ import java.util.concurrent.TimeUnit
@State(Scope.Benchmark)
class InitializedAccessAny {

var holder: LazyAnyHolder = _
var holder: LazyAnyHolder = uninitialized

@Setup
def prepare: Unit = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dotty.tools.benchmarks.lazyvals

import compiletime.uninitialized
import org.openjdk.jmh.annotations._
import LazyVals.LazyGenericHolder
import org.openjdk.jmh.infra.Blackhole
Expand All @@ -14,7 +15,7 @@ import java.util.concurrent.TimeUnit
@State(Scope.Benchmark)
class InitializedAccessGeneric {

var holder: LazyGenericHolder[String] = _
var holder: LazyGenericHolder[String] = uninitialized

@Setup
def prepare: Unit = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dotty.tools.benchmarks.lazyvals

import compiletime.uninitialized
import org.openjdk.jmh.annotations.*
import org.openjdk.jmh.infra.Blackhole
import LazyVals.LazyIntHolder
Expand All @@ -14,7 +15,7 @@ import java.util.concurrent.TimeUnit
@State(Scope.Benchmark)
class InitializedAccessInt {

var holder: LazyIntHolder = _
var holder: LazyIntHolder = uninitialized

@Setup
def prepare: Unit = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dotty.tools.benchmarks.lazyvals

import compiletime.uninitialized
import org.openjdk.jmh.annotations._
import LazyVals.LazyHolder
import org.openjdk.jmh.infra.Blackhole
Expand All @@ -14,7 +15,7 @@ import java.util.concurrent.TimeUnit
@State(Scope.Benchmark)
class InitializedAccessMultiple {

var holders: Array[LazyHolder] = _
var holders: Array[LazyHolder] = uninitialized

@Setup
def prepare: Unit = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dotty.tools.benchmarks.lazyvals

import compiletime.uninitialized
import org.openjdk.jmh.annotations._
import LazyVals.LazyStringHolder
import org.openjdk.jmh.infra.Blackhole
Expand All @@ -14,7 +15,7 @@ import java.util.concurrent.TimeUnit
@State(Scope.Benchmark)
class InitializedAccessString {

var holder: LazyStringHolder = _
var holder: LazyStringHolder = uninitialized

@Setup
def prepare: Unit = {
Expand Down

0 comments on commit 85b1c0e

Please sign in to comment.