[add] first
This commit is contained in:
26
benchmark/server/http.ts
Normal file
26
benchmark/server/http.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { HttpServer } from '../../src/index';
|
||||
import { serviceProto } from "../protocols/proto";
|
||||
|
||||
async function main() {
|
||||
let server = new HttpServer(serviceProto, {
|
||||
logger: {
|
||||
debug: () => { },
|
||||
log: () => { },
|
||||
error: console.error.bind(console),
|
||||
warn: console.warn.bind(console)
|
||||
}
|
||||
});
|
||||
|
||||
server.implementApi('Test', call => {
|
||||
call.succ(call.req);
|
||||
});
|
||||
|
||||
await server.start();
|
||||
|
||||
setInterval(() => {
|
||||
let used = process.memoryUsage().heapUsed / 1024 / 1024;
|
||||
console.log(`内存: ${Math.round(used * 100) / 100} MB`);
|
||||
}, 2000)
|
||||
}
|
||||
|
||||
main();
|
||||
26
benchmark/server/ws.ts
Normal file
26
benchmark/server/ws.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { WsServer } from '../../src/index';
|
||||
import { serviceProto } from "../protocols/proto";
|
||||
|
||||
async function main() {
|
||||
let server = new WsServer(serviceProto, {
|
||||
logger: {
|
||||
debug: () => { },
|
||||
log: () => { },
|
||||
error: console.error.bind(console),
|
||||
warn: console.warn.bind(console)
|
||||
}
|
||||
});
|
||||
|
||||
server.implementApi('Test', call => {
|
||||
call.succ(call.req);
|
||||
});
|
||||
|
||||
await server.start();
|
||||
|
||||
setInterval(() => {
|
||||
let used = process.memoryUsage().heapUsed / 1024 / 1024;
|
||||
console.log(`内存: ${Math.round(used * 100) / 100} MB`);
|
||||
}, 2000)
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in New Issue
Block a user