[WASM] Caching string literals in global pool
This commit is contained in:
@@ -15,7 +15,7 @@ internal fun insertString(array: CharArray, destinationIndex: Int, value: String
|
||||
internal fun unsafeStringFromCharArray(array: CharArray, start: Int, size: Int): String {
|
||||
val copy = WasmCharArray(size)
|
||||
copyWasmArray(array.storage, copy, start, 0, size)
|
||||
return String(copy)
|
||||
return copy.createString()
|
||||
}
|
||||
|
||||
internal fun insertInt(array: CharArray, start: Int, value: Int): Int {
|
||||
|
||||
@@ -75,7 +75,7 @@ public actual fun String(chars: CharArray, offset: Int, length: Int): String {
|
||||
|
||||
val copy = WasmCharArray(length)
|
||||
copyWasmArray(chars.storage, copy, offset, 0, length)
|
||||
return String(copy)
|
||||
return copy.createString()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +88,7 @@ public actual fun CharArray.concatToString(): String {
|
||||
val thisLength = thisStorage.len()
|
||||
val copy = WasmCharArray(thisLength)
|
||||
copyWasmArray(this.storage, copy, 0, 0, thisLength)
|
||||
return String(copy)
|
||||
return copy.createString()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,7 +109,7 @@ public actual fun CharArray.concatToString(startIndex: Int = 0, endIndex: Int =
|
||||
val length = endIndex - startIndex
|
||||
val copy = WasmCharArray(length)
|
||||
copyWasmArray(this.storage, copy, startIndex, 0, length)
|
||||
return String(copy)
|
||||
return copy.createString()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user