Fixing bug with not closed file while moving to new destination
This commit is contained in:
27
src/test.ts
27
src/test.ts
@ -31,8 +31,25 @@ cus22.log("Hello from custom Logger 22")
|
||||
cus2.log("Hello from custom Logger 2")
|
||||
|
||||
Logging.console_out = false;
|
||||
// Logging.waitForSetup().then(() => {
|
||||
// for (let i = 0; i < 7000; i++) {
|
||||
// Logging.log(randomBytes(50000).toString("hex"))
|
||||
// }
|
||||
// });
|
||||
async function benchmark(count: number, message_size: number) {
|
||||
await Logging.waitForSetup();
|
||||
const randData = randomBytes(message_size).toString("hex")
|
||||
const t = process.hrtime();
|
||||
for (let i = 0; i < count; i++) {
|
||||
Logging.log(randData)
|
||||
}
|
||||
const diff = process.hrtime(t);
|
||||
const NS_PER_SEC = 1e9;
|
||||
await Logging.waitForSetup();
|
||||
const ns = diff[0] * NS_PER_SEC + diff[1];
|
||||
console.log(`Benchmark took ${ns / 1000000}ms for ${count} messages with a size of ${message_size} characters`);
|
||||
console.log(`This is equal to ${(ns / 1000000) / count} ms per message`)
|
||||
}
|
||||
|
||||
Logging.waitForSetup().then(async () => {
|
||||
console.log("Large data benchmark:")
|
||||
await benchmark(7000, 50000);
|
||||
|
||||
console.log("Realdata data benchmark:")
|
||||
await benchmark(100000, 100)
|
||||
});
|
Reference in New Issue
Block a user