加个这玩意

This commit is contained in:
shenjack 2024-05-10 23:01:19 +08:00
parent 5a6e38274d
commit c02ac6234f
Signed by: shenjack
GPG Key ID: 7B1134A979775551
2 changed files with 9 additions and 3 deletions

View File

@ -207,17 +207,20 @@ function wrap_any(names, round) {
} }
function main() { function main() {
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var fs, path, names, result; var fs, path, names, start_time, result, end_time;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
case 0: case 0:
fs = require("fs"); fs = require("fs");
path = require("path"); path = require("path");
names = fs.readFileSync(path.resolve(__dirname, "input.txt"), "utf-8"); names = fs.readFileSync(path.resolve(__dirname, "input.txt"), "utf-8");
return [4 /*yield*/, wrap_any(names, 1000)]; start_time = Date.now();
return [4 /*yield*/, wrap_any(names, 10000)];
case 1: case 1:
result = _a.sent(); result = _a.sent();
end_time = Date.now();
console.log(result); console.log(result);
console.log("Node.js \u8017\u65F6: ".concat(end_time - start_time, " ms"));
return [2 /*return*/]; return [2 /*return*/];
} }
}); });

View File

@ -195,8 +195,11 @@ async function main() {
// const result = await fight(names); // const result = await fight(names);
// const result = await md5_module.run_any(names, 50000); // const result = await md5_module.run_any(names, 50000);
// console.log(`赢家:|${result.source_plr}|`); // console.log(`赢家:|${result.source_plr}|`);
const result = await wrap_any(names, 1000); const start_time = Date.now();
const result = await wrap_any(names, 10000);
const end_time = Date.now();
console.log(result); console.log(result);
console.log(`Node.js 耗时: ${end_time - start_time} ms`);
} }
main(); main();