Improve StringByteString performance
This commit is contained in:
parent
3ead24267c
commit
adab78f0c0
luna/src/main/java/org/classdump/luna
src/main/kotlin/ru/dbotthepony/kstarbound/lua
@ -64,6 +64,10 @@ class StringByteString extends ByteString {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (that instanceof StringByteString tstring) {
|
||||||
|
return string.equals(tstring.string);
|
||||||
|
}
|
||||||
|
|
||||||
// don't force hashCode computation, but use if already known
|
// don't force hashCode computation, but use if already known
|
||||||
int thisHash = this.maybeHashCode();
|
int thisHash = this.maybeHashCode();
|
||||||
int thatHash = that.maybeHashCode();
|
int thatHash = that.maybeHashCode();
|
||||||
|
@ -230,9 +230,11 @@ private object JsonTableIndex : AbstractFunction3<Table, Any, Any?>() {
|
|||||||
throw NonsuspendableFunctionException(this::class.java)
|
throw NonsuspendableFunctionException(this::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val __nils: ByteString = ByteString.of("__nils")
|
||||||
|
|
||||||
override fun invoke(context: ExecutionContext, self: Table, key: Any, value: Any?) {
|
override fun invoke(context: ExecutionContext, self: Table, key: Any, value: Any?) {
|
||||||
val meta = self.metatable
|
val meta = self.metatable
|
||||||
val nils = meta["__nils"] as Table
|
val nils = meta[__nils] as Table
|
||||||
|
|
||||||
// If we are setting an entry to nil, need to add a bogus integer entry
|
// If we are setting an entry to nil, need to add a bogus integer entry
|
||||||
// to the __nils table, otherwise need to set the entry *in* the __nils
|
// to the __nils table, otherwise need to set the entry *in* the __nils
|
||||||
|
Loading…
Reference in New Issue
Block a user