more inlining and minor performance tweaks on LightmapRenderer

This commit is contained in:
minjaesong
2017-06-12 04:04:54 +09:00
parent 2ca8c2c263
commit ded19d3ae7
15 changed files with 171 additions and 220 deletions

View File

@@ -11,9 +11,9 @@ package net.torvald.dataclass
*/
class CircularArray<T>(val size: Int) {
private val buffer: Array<T> = arrayOfNulls<Any>(size) as Array<T>
private var tail: Int = 0
private var head: Int = 0
val buffer: Array<T> = arrayOfNulls<Any>(size) as Array<T>
var tail: Int = 0
var head: Int = 0
val elemCount: Int
get() = if (tail >= head) tail - head else size
@@ -26,7 +26,7 @@ class CircularArray<T>(val size: Int) {
}
}
fun forEach(action: (T) -> Unit) {
inline fun forEach(action: (T) -> Unit) {
/*if (tail >= head) { // queue not full
(head..tail - 1).map { buffer[it] }.forEach { action(it) }
}
@@ -45,11 +45,11 @@ class CircularArray<T>(val size: Int) {
}
}
fun forEachConcurrent(action: (T) -> Unit) {
inline fun forEachConcurrent(action: (T) -> Unit) {
TODO()
}
fun forEachConcurrentWaitFor(action: (T) -> Unit) {
inline fun forEachConcurrentWaitFor(action: (T) -> Unit) {
TODO()
}