Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var responseHeader = {
magic: 0x81,
opcode: 1,
keyLength: 15,
extrasLength: 0,
dataType: 0,
status: 1,
totalBodyLength: 1024 * 10 + 15,
opaque: 0,
cas: Buffer.from([0x0a, 0, 0, 0, 0, 0, 0, 0])
};
var buf = Buffer.alloc(24 + 15 + 1024 * 10);
header.toBuffer(responseHeader).copy(buf);
buf.write(makeString(55));
var server = new memjs.Server();
var dummyFunc = function(arg) {
server.onResponse(dummyFunc);
return arg;
};
var i;
for (i = 0; i < 10; i++) {
server.onResponse(dummyFunc);
}
suite.add('Server#respond', function() {
server.respond('helloworldthisisatesttohowmuchyouareaversetocopyingoverthestargatecommisionandromanticizingaboutmylifelongpassionforlearningandyieldingtoyourdesires');
})
.add('Server#responseHandler', function() {
server.responseHandler(buf);