Commit 02ad8f22f2b for nodejs

commit 02ad8f22f2b99eb89d6ebc57f93d2b522bd55e0c
Author: Roberto Bianchi <roberto.bianchi@spendesk.com>
Date:   Fri Nov 13 18:11:04 2026 +0100

    util: use indexed writes for inspected object properties

    Avoid the cost of primordial push calls for each formatted property.

    Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
    PR-URL: https://github.com/nodejs/node/pull/67297
    Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
    Reviewed-By: Jordan Harband <ljharb@gmail.com>

diff --git a/benchmark/util/inspect.js b/benchmark/util/inspect.js
index 8e453b9e226..23beac0039b 100644
--- a/benchmark/util/inspect.js
+++ b/benchmark/util/inspect.js
@@ -14,6 +14,7 @@ const bench = common.createBenchmark(main, {
     'Object',
     'Object_empty',
     'Object_deep_ln',
+    'Object_large',
     'String',
     'String_complex',
     'String_boxed',
@@ -61,6 +62,13 @@ function main({ method, n, option }) {
                     g: 'seventh' } } } };
       benchmark(n, obj, options || { depth: Infinity });
       break;
+    case 'Object_large':
+      obj = {};
+      for (let i = 0; i < 50; i++) {
+        obj[`key${i}`] = i;
+      }
+      benchmark(n, obj, options);
+      break;
     case 'String':
       benchmark(n, 'Simple string', options);
       break;
diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js
index 7ee10319658..26cf23bf0fa 100644
--- a/lib/internal/util/inspect.js
+++ b/lib/internal/util/inspect.js
@@ -1434,14 +1434,12 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
           const tempValue = { [extraKeys[i]]: value.buffer[extraKeys[i]] };
           formatted = formatExtraProperties(ctx, tempValue, recurseTimes, extraKeys[i], typedArray);
         }
-        ArrayPrototypePush(output, formatted);
+        output[output.length] = formatted;
       }
     }
     for (i = 0; i < keys.length; i++) {
-      ArrayPrototypePush(
-        output,
-        formatProperty(ctx, value, recurseTimes, keys[i], extrasType),
-      );
+      output[output.length] =
+        formatProperty(ctx, value, recurseTimes, keys[i], extrasType);
     }
     if (protoProps !== undefined) {
       ArrayPrototypePushApply(output, protoProps);