-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document and address WebAssembly constraints #73
Comments
These numbers are relevant for crossing the WebIDL boundary. In that case, it was assumed that the wasm side needs to see UTF-8 anyway. Since ICU4X will be able to operate on UTF-16, it would be worthwhile to consider a non-WebIDL method on JS TC39 may want to consider:
CC @annevk |
Correction: Writes the code units as 16-bit units without ensuring UTF-16 validity. |
As part of this it would be ideal if the feature request in whatwg/encoding#174 could also be considered. The most natural place for that seems to be some extension to JavaScript strings rather than a new feature on the Encoding API objects. |
@hsivonen That just seems like it's reinventing Since |
For UTF-8, yes, except without WebIDL. How big of a performance win not having WebIDL in there would be should be benchmarked before committing. For UTF-16, no. |
WebAssembly guarantees little endian (since no mainstream CPUs use big endian), so there's no problem with Or are you concerned about something else? |
Yes: Alignment. A UTF-16LE encoder writing by byte to a buffer that is actually aligned to even addresses is either more complex (if it checks for alignment and has multiple paths) or less efficient (if it writes by byte) than one that gets to assume it can do aligned 16-bit writes. |
@hsivonen Okay, but I don't see why the encoder can't internally use But even if there was some reason that wouldn't work, So why do we need a new API that just does the same thing as |
CC @littledan |
See #207 for additional discussion on this subject. |
@hagbard wrote a doc with some constraints that WebAssembly brings that make it not a viable option for ICU4X porting to the Web Platform. We should:
The text was updated successfully, but these errors were encountered: