perf: use JSON.parse instead of JSON5.parse for sessions.json (~35x faster) (#14530)

Co-authored-by: hyf0-agent <hyf0-agent@users.noreply.github.com>
This commit is contained in:
hyf0-agent
2026-02-12 16:10:21 +08:00
committed by GitHub
parent 16f2492547
commit 5c32989f53

View File

@@ -1,4 +1,3 @@
import JSON5 from "json5";
import crypto from "node:crypto"; import crypto from "node:crypto";
import fs from "node:fs"; import fs from "node:fs";
import path from "node:path"; import path from "node:path";
@@ -144,7 +143,7 @@ export function loadSessionStore(
let mtimeMs = getFileMtimeMs(storePath); let mtimeMs = getFileMtimeMs(storePath);
try { try {
const raw = fs.readFileSync(storePath, "utf-8"); const raw = fs.readFileSync(storePath, "utf-8");
const parsed = JSON5.parse(raw); const parsed = JSON.parse(raw);
if (isSessionStoreRecord(parsed)) { if (isSessionStoreRecord(parsed)) {
store = parsed; store = parsed;
} }