Bring back fastutil usage
This commit is contained in:
parent
4407fc3de6
commit
36b2f0670c
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
package ru.dbotthepony.kommons.networking
|
package ru.dbotthepony.kommons.networking
|
||||||
|
|
||||||
|
import it.unimi.dsi.fastutil.objects.Reference2ObjectFunction
|
||||||
|
import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap
|
||||||
|
import it.unimi.dsi.fastutil.objects.ReferenceArraySet
|
||||||
import ru.dbotthepony.kommons.collect.ProxiedMap
|
import ru.dbotthepony.kommons.collect.ProxiedMap
|
||||||
import ru.dbotthepony.kommons.collect.forValidRefs
|
import ru.dbotthepony.kommons.collect.forValidRefs
|
||||||
import ru.dbotthepony.kommons.event.IBooleanSubscriptable
|
import ru.dbotthepony.kommons.event.IBooleanSubscriptable
|
||||||
@ -320,11 +323,11 @@ class FieldSynchronizer(private val callback: Runnable, private val alwaysCallCa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val dirtyFields = LinkedHashSet<AbstractField<*>>()
|
private val dirtyFields = ReferenceArraySet<AbstractField<*>>(4)
|
||||||
|
|
||||||
// use LinkedList because it is ensured memory is freed on LinkedList#clear
|
// use LinkedList because it is ensured memory is freed on LinkedList#clear
|
||||||
private val mapBacklogs = IdentityHashMap<Map<*, *>, LinkedList<Pair<Any?, (DataOutputStream) -> Unit>>>()
|
private val mapBacklogs = Reference2ObjectOpenHashMap<Map<*, *>, LinkedList<Pair<Any?, (DataOutputStream) -> Unit>>>()
|
||||||
private val setBacklogs = IdentityHashMap<Set<*>, LinkedList<Pair<Any?, (DataOutputStream) -> Unit>>>()
|
private val setBacklogs = Reference2ObjectOpenHashMap<Set<*>, LinkedList<Pair<Any?, (DataOutputStream) -> Unit>>>()
|
||||||
|
|
||||||
var unused: Boolean = false
|
var unused: Boolean = false
|
||||||
private set
|
private set
|
||||||
@ -372,9 +375,9 @@ class FieldSynchronizer(private val callback: Runnable, private val alwaysCallCa
|
|||||||
return LinkedList()
|
return LinkedList()
|
||||||
}
|
}
|
||||||
|
|
||||||
return mapBacklogs.computeIfAbsent(map) {
|
return mapBacklogs.computeIfAbsent(map, Reference2ObjectFunction {
|
||||||
LinkedList()
|
LinkedList()
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun <K, V> removeMapBacklog(map: Map<K, V>) {
|
internal fun <K, V> removeMapBacklog(map: Map<K, V>) {
|
||||||
@ -386,9 +389,9 @@ class FieldSynchronizer(private val callback: Runnable, private val alwaysCallCa
|
|||||||
return LinkedList()
|
return LinkedList()
|
||||||
}
|
}
|
||||||
|
|
||||||
return setBacklogs.computeIfAbsent(set) {
|
return setBacklogs.computeIfAbsent(set, Reference2ObjectFunction {
|
||||||
LinkedList()
|
LinkedList()
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun <V> removeSetBacklog(set: Set<V>) {
|
internal fun <V> removeSetBacklog(set: Set<V>) {
|
||||||
|
Loading…
Reference in New Issue
Block a user