- From: Luke Wagner <notifications@github.com>
- Date: Wed, 31 Oct 2018 07:56:29 -0700
- To: whatwg/encoding <encoding@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Wednesday, 31 October 2018 14:56:51 UTC
@domenic Ok, I can see that point of view and I hesitated while writing my final comment for the same reason. Although it requires a bit more optimization magic (which I generally like to avoid), one of the stated goals of wasm Host Bindings is that, when you have a wasm Host Binding coercion that says "create a view from a i32 (begin,end) pair", the engine can optimize away the view allocation and pass the (begin,end) pair directly to an optimized Web IDL internal entry point. With luck, the JS JIT could even hit the same path when the `new Uint8Array()` call is obviously exclusively consumed by the method call. So I'm fine sticking with the view. @ricea Thanks for the writeup! Yes, that's what I was imagining (s/arg triplet/view/). The surrounding conversion code could avoid exceptions in even more (or all) cases by using `string.length` to make the reservation, and probably a stack-y allocator to avoid general-purpose malloc/free overhead making the whole routine rather efficient. -- 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/69#issuecomment-434718429
Received on Wednesday, 31 October 2018 14:56:51 UTC