Description
The blob/blob.js
benchmark is taking hours: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1402/console
This probably didn't take so long in the past, there is this PR that changed the Blob's behavior a lot: nodejs/node#45258
From what I saw, the problem is in the JS->C++ transitions, for each piece of data it crosses JS->C++.
Furthermore, the text
function expects arraybuffer
and then calls decode
, when we could just decode
the data as soon as we get it from the C++ instead of keeping everything in memory and then discarding it.
I can do some optimizations on the JS side but I think this could be largely improved if we do the heavy operations on C++, I have no idea how to handle the asynchronous code on C++, so I accept some hints or if anyone wants to try work on this.