Re: [whatwg/encoding] Consider adding TextEncoder.containsLoneSurrogates() static (#174)

> Our goal is to be as fast as possible (zero-cost ideally), at least as fast as JS, and in the future faster-than-JS.

@Pauan Sure, but the error case is rare and not something I'd optimise for, while the success case should be fast with either approach and dominated by the string encoding performance and not error handling.

In this case having idiomatic JS APIs feels more important than relatively small speed improvements, especially since in the future  WASM might switch to some host bindings encoding approach, while the API is here to stay for JS developers too. 

> I admit they're not quite the same as TextEncoder, but there is some precedence for returning null

Yeah, but all of these are not really failures (like `Result`), but more like `Option`s where "doesn't exist" is a valid and common state and not an error. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/encoding/issues/174#issuecomment-479404249

Received on Wednesday, 3 April 2019 09:04:53 UTC