Ingvar Stepanyan 12011f4537 Add specialised passStringToWasm for Node.js
Node.js doesn't currently implement `TextEncoder::encodeInto`. I've raised an upstream issue to add it - https://github.com/nodejs/node/issues/26904 - but it's likely to take some time and will be available only in new releases.

In the meanwhile, it's worth noting that Node.js already has `Buffer::write` which has pretty similar semantics, but doesn't require creating an intermediate view using `.subarray` and instead accepts pointer and length directly.

Also, Node.js has `Buffer::byteLength` helper which allows to efficiently retrieve an encoded byte length of a string upfront, and so allows us to avoid a loop with reallocations.

This change takes leverage of these methods by generating an additional Buffer-based view into the WASM memory and using it for string operations.

I'm seeing up to 35% increase in performance in string-heavy library benchmarks.
2019-03-25 17:42:16 +00:00
..
2019-03-21 17:08:48 -07:00
2019-03-21 17:08:48 -07:00
2019-03-21 17:08:48 -07:00
2019-03-21 17:08:48 -07:00
2019-03-21 17:08:48 -07:00
2019-03-21 17:08:48 -07:00
2019-03-21 17:08:48 -07:00
2019-03-21 17:08:48 -07:00
2019-03-21 17:08:48 -07:00
2019-03-21 17:08:48 -07:00
2018-11-27 12:07:59 -08:00
2019-03-15 22:15:04 -03:00
2019-03-21 17:08:48 -07:00
2019-03-21 17:08:48 -07:00
2019-03-21 17:08:48 -07:00