Package io.keikai.doc.collab.lib0
Class StringEncoder
java.lang.Object
io.keikai.doc.collab.lib0.StringEncoder
Optimized String Encoder.
Encoding many small strings in a simple Encoder is not very efficient. The function call to decode a string takes some time and creates references that must be eventually deleted.
In practice, when decoding several million small strings, the GC will kick in more and more often to collect orphaned string objects (or maybe there is another reason?).
This string encoder solves the above problem. All strings are concatenated and written as a single string using a single encoding call.
The lengths are encoded using a UintOptRleEncoder.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
StringEncoder
public StringEncoder()
-
-
Method Details
-
write
-
toUint8Array
-