util: improve util.inspect performance
Fixes #14487 (closed)
A hole in a sparse array is now in itself a O(1) operation instead of O(n) where n is the number of coherent elements of the hole.
In addition a hasOwnProperty
check was replaced with a cheaper one.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
Affected core subsystem(s)
util