Skip to content

Commit 4ddafbd

Browse files
committed
Benchmark: add /unicode/nnn bench to http_simple.js
1 parent 7f68f25 commit 4ddafbd

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

benchmark/http_simple.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ console.log('pid ' + process.pid);
88

99
var fixed = makeString(20 * 1024, 'C'),
1010
storedBytes = {},
11-
storedBuffer = {};
11+
storedBuffer = {},
12+
storedUnicode = {};
1213

1314
var useDomains = process.env.NODE_USE_DOMAINS;
1415

@@ -60,6 +61,16 @@ var server = http.createServer(function (req, res) {
6061
}
6162
body = storedBuffer[n];
6263

64+
} else if (command == 'unicode') {
65+
var n = ~~arg;
66+
if (n <= 0)
67+
throw new Error('unicode called with n <= 0');
68+
if (storedUnicode[n] === undefined) {
69+
console.log('create storedUnicode[n]');
70+
storedUnicode[n] = makeString(n, '\u263A');
71+
}
72+
body = storedUnicode[n];
73+
6374
} else if (command == 'quit') {
6475
res.connection.server.close();
6576
body = 'quitting';

0 commit comments

Comments
 (0)