Commit 7bdd1f6363b for nodejs

commit 7bdd1f6363b12fe045311c0b0a5c44ae5ba896b2
Author: James Ross <james@jross.me>
Date:   Mon Sep 28 01:52:10 2026 +0100

    benchmark: add zstdCompress benchmark

    Signed-off-by: James Ross <james@jross.me>
    PR-URL: https://github.com/nodejs/node/pull/66358
    Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
    Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>

diff --git a/benchmark/zlib/zstd-compress.js b/benchmark/zlib/zstd-compress.js
new file mode 100644
index 00000000000..b898397c222
--- /dev/null
+++ b/benchmark/zlib/zstd-compress.js
@@ -0,0 +1,41 @@
+'use strict';
+const common = require('../common.js');
+const fs = require('fs');
+const zlib = require('zlib');
+
+const bench = common.createBenchmark(main, {
+  method: ['zstdCompress', 'zstdCompressSync'],
+  level: [3, 12],
+  inputLen: [16 * 1024, 256 * 1024],
+  n: [100],
+});
+
+function main({ n, method, level, inputLen }) {
+  const input = Buffer.alloc(inputLen, fs.readFileSync(__filename));
+  const opts = { params: { [zlib.constants.ZSTD_c_compressionLevel]: level } };
+
+  switch (method) {
+    // Performs `n` single zstdCompress operations
+    case 'zstdCompress': {
+      let i = 0;
+      bench.start();
+      (function next(err) {
+        if (err) throw err;
+        if (i++ === n)
+          return bench.end(n);
+        zlib.zstdCompress(input, opts, next);
+      })();
+      break;
+    }
+    // Performs `n` single zstdCompressSync operations
+    case 'zstdCompressSync': {
+      bench.start();
+      for (let i = 0; i < n; ++i)
+        zlib.zstdCompressSync(input, opts);
+      bench.end(n);
+      break;
+    }
+    default:
+      throw new Error('Unsupported zstd method');
+  }
+}