Skip to content

Blob.text and Blob.arraybuffer are 10x+ slower on 20.x #118

Open
@H4ad

Description

@H4ad

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions