GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — benchmark: add parameters to text-decoder benchmark · nodejs/node@762d285

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • benchmark/util
    • text-decoder.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎benchmark/util/text-decoder.js‎

Copy file name to clipboardExpand all lines: benchmark/util/text-decoder.js
+19-3Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,28 @@ const bench = common.createBenchmark(main, {
66
encoding: ['utf-8', 'latin1', 'iso-8859-3'],
77
ignoreBOM: [0, 1],
88
len: [256, 1024 * 16, 1024 * 512],
9-
n: [1e6]
9+
n: [1e2],
10+
type: ['SharedArrayBuffer', 'ArrayBuffer', 'Buffer']
1011
});
1112

12-
function main({ encoding, len, n, ignoreBOM }) {
13-
const buf = Buffer.allocUnsafe(len);
13+
function main({ encoding, len, n, ignoreBOM, type }) {
1414
const decoder = new TextDecoder(encoding, { ignoreBOM });
15+
let buf;
16+
17+
switch (type) {
18+
case 'SharedArrayBuffer': {
19+
buf = new SharedArrayBuffer(len);
20+
break;
21+
}
22+
case 'ArrayBuffer': {
23+
buf = new ArrayBuffer(len);
24+
break;
25+
}
26+
case 'Buffer': {
27+
buf = Buffer.allocUnsafe(len);
28+
break;
29+
}
30+
}
1531

1632
bench.start();
1733
for (let i = 0; i < n; i++) {

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.