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
import androidx.compose.animation.core.Animatable | |
import androidx.compose.animation.core.Easing | |
import androidx.compose.animation.core.LinearEasing | |
import androidx.compose.animation.core.tween | |
import androidx.compose.foundation.Canvas | |
import androidx.compose.foundation.layout.BoxWithConstraints | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.foundation.layout.offset | |
import androidx.compose.material.Text | |
import androidx.compose.runtime.Composable |
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
import org.openjdk.jmh.annotations.*; | |
import org.openjdk.jmh.infra.Blackhole; | |
import java.util.concurrent.TimeUnit; | |
public class SyncNotSyncBenchmark { | |
@State(Scope.Thread) | |
public static class MyState { | |
public int loopSize = 100; |
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
Benchmark Mode Cnt Score Error Units | |
SyncNotSyncBenchmark.nonSyncTest avgt 25 537.927 ± 1.799 ns/op | |
SyncNotSyncBenchmark.syncTes avgt 25 16097.174 ± 938.583 ns/op |
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
import org.openjdk.jmh.annotations.*; | |
import org.openjdk.jmh.infra.Blackhole; | |
import java.util.concurrent.TimeUnit; | |
public class CompareOperatorsBenchMark { | |
// Нужано, для того, что бы не передавать константы напрямую в измеряемый код, т.к. Java может их оптимизировать | |
@State(Scope.Thread) | |
public static class MyIntState { | |
public int a = 1; |
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
Benchmark Mode Cnt Score Error Units | |
CompareOperatorsBenchMark.add avgt 25 1.975 ± 0.066 ns/op | |
CompareOperatorsBenchMark.instanceOf avgt 25 2.029 ± 0.007 ns/op | |
CompareOperatorsBenchMark.notEqualsWithDouble avgt 25 2.281 ± 0.006 ns/op | |
CompareOperatorsBenchMark.notEqualsWithInt avgt 25 2.053 ± 0.012 ns/op |