Benchmark: add /unicode/nnn bench to http_simple.js
This commit is contained in:
parent
7f68f256cf
commit
4ddafbd563
@ -8,7 +8,8 @@ console.log('pid ' + process.pid);
|
|||||||
|
|
||||||
var fixed = makeString(20 * 1024, 'C'),
|
var fixed = makeString(20 * 1024, 'C'),
|
||||||
storedBytes = {},
|
storedBytes = {},
|
||||||
storedBuffer = {};
|
storedBuffer = {},
|
||||||
|
storedUnicode = {};
|
||||||
|
|
||||||
var useDomains = process.env.NODE_USE_DOMAINS;
|
var useDomains = process.env.NODE_USE_DOMAINS;
|
||||||
|
|
||||||
@ -60,6 +61,16 @@ var server = http.createServer(function (req, res) {
|
|||||||
}
|
}
|
||||||
body = storedBuffer[n];
|
body = storedBuffer[n];
|
||||||
|
|
||||||
|
} else if (command == 'unicode') {
|
||||||
|
var n = ~~arg;
|
||||||
|
if (n <= 0)
|
||||||
|
throw new Error('unicode called with n <= 0');
|
||||||
|
if (storedUnicode[n] === undefined) {
|
||||||
|
console.log('create storedUnicode[n]');
|
||||||
|
storedUnicode[n] = makeString(n, '\u263A');
|
||||||
|
}
|
||||||
|
body = storedUnicode[n];
|
||||||
|
|
||||||
} else if (command == 'quit') {
|
} else if (command == 'quit') {
|
||||||
res.connection.server.close();
|
res.connection.server.close();
|
||||||
body = 'quitting';
|
body = 'quitting';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user