mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 02:54:04 +09:00
a little experimets
This commit is contained in:
@@ -11,12 +11,23 @@ import kotlin.math.roundToInt
|
|||||||
* NOTE: Panama's new vectors are all immutable.
|
* NOTE: Panama's new vectors are all immutable.
|
||||||
* NOTE2: Class inlining vastly improves the performance
|
* NOTE2: Class inlining vastly improves the performance
|
||||||
*
|
*
|
||||||
* -XX:TypeProfileLevel=121 -XX:+UseVectorApiIntrinsics --add-modules=jdk.incubator.vector
|
|
||||||
*
|
|
||||||
* Created by minjaesong on 2019-05-20.
|
* Created by minjaesong on 2019-05-20.
|
||||||
*/
|
*/
|
||||||
inline class Cvec constructor(val vec: FloatVector) {
|
inline class Cvec constructor(val vec: FloatVector) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
Test log
|
||||||
|
|
||||||
|
I ran with following jvm args:
|
||||||
|
-XX:TypeProfileLevel=121 -XX:+UseVectorApiIntrinsics --add-modules=jdk.incubator.vector
|
||||||
|
and it's slower than the legacy.
|
||||||
|
|
||||||
|
This time I removed the TypeProfileLevel part. It now runs slightly faster than the legacy?
|
||||||
|
-XX:+UseVectorApiIntrinsics --add-modules=jdk.incubator.vector
|
||||||
|
|
||||||
|
<<append from here>>
|
||||||
|
*/
|
||||||
|
|
||||||
//constructor(floatArray: FloatArray) : this(FloatVector.fromArray(SPECIES, floatArray, 0))
|
//constructor(floatArray: FloatArray) : this(FloatVector.fromArray(SPECIES, floatArray, 0))
|
||||||
constructor(r: Float, g: Float, b: Float, a: Float) : this(FloatVector.scalars(SPECIES, r, g, b, a))
|
constructor(r: Float, g: Float, b: Float, a: Float) : this(FloatVector.scalars(SPECIES, r, g, b, a))
|
||||||
constructor(scalar: Float) : this(FloatVector.scalars(SPECIES, scalar, scalar, scalar, scalar))
|
constructor(scalar: Float) : this(FloatVector.scalars(SPECIES, scalar, scalar, scalar, scalar))
|
||||||
@@ -24,7 +35,7 @@ inline class Cvec constructor(val vec: FloatVector) {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val EPSILON = 1f / 512f
|
private val EPSILON = 1f / 512f
|
||||||
private val SPECIES = FloatVector.SPECIES_256
|
private val SPECIES = FloatVector.SPECIES_128
|
||||||
}
|
}
|
||||||
|
|
||||||
//fun cpy(): Cvec = Cvec(this.vec)
|
//fun cpy(): Cvec = Cvec(this.vec)
|
||||||
|
|||||||
Reference in New Issue
Block a user