[add] first

This commit is contained in:
2022-04-29 15:25:10 +08:00
commit da8024fc30
87 changed files with 16892 additions and 0 deletions

26
benchmark/server/http.ts Normal file
View 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
View 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();