You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fromWtf8Array with no start/length parameters ? #9
My understanding is that the interface to fromWtf8Array was taken from stringref, where the use case might be, you have a buffered I/O port with an (array i8) holding your bytes, and you want to decode a part of that buffer. In that case it definitely makes sense to take a start and an offset.
However for wtf-8 string conversion on the boundary, for languages that use UTF-8 or WTF-8 internally -- i.e., where you're not using externref to actually represent the strings, but instead you are using the JS string builtins to perform a more efficient encode/decode when communicating with the host -- there, you are much more likely to just have a full (array i8). You will be decoding the whole thing. In that case binary size and runtime overhead will be minimized if we can remove the start and end arguments, and just assume we transcode the whole buffer.
Activity
eqrion commentedon Dec 5, 2023
@wingo Would this new function just be a short hand for:
I can see that being a good binary size reduction (but would also be interested in some data).
Are you imagining this operation would be more efficient than the version operating on a slice?