-
Notifications
You must be signed in to change notification settings - Fork 68
Description
Ever since Node.js 14 support got added to this library, and when run under Node.js 14+, we're having very slow performance when using this module.
Investigation showed that every external node::Buffer allocation would lead to a GC, and indeed, a lot of allocations make a buffer of 0x3fffffff
in length leading to the external memory country in V8 getting angry.
Looking a bit further, we find this bit of code:
Line 144 in a7f62a4
length = std::max<size_t>(length, kMaxLength); |
... which uses std::max
to make every allocation the maximum length, which in this case is 0x3fffffff.
Sadly, changing this to std::min
makes for a lot of intermittent failures of the Check failed: result.second.
kind returning when run repeatedly. I guess the initial Node.js 14+ support never worked correctly and relied on this broken behavior.