Commit 498e038e by luoqi

docs(persona): 注明重算串行 — CPU-bound,异步并发不提速

persona 重算 16 特征是 Node 单线程 CPU 计算,实测 conc=8 不提速反略慢;
加注释解释为何保持串行(真要提速需 profile 或多进程/worker)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
parent d0797f48
......@@ -62,6 +62,7 @@ async function bootstrap() {
// noop = 水位闸命中(自上次重算无新事件,沿用旧 persona),是正常结果,
// 不能并入 failed —— 否则全量重跑(无新增事实)会误报"全失败"。
let ok = 0, partial = 0, noop = 0, failed = 0;
// 串行:persona 重算 Node-CPU-bound(特征计算占主),异步并发不提速(见 scheduler 注释)。
for (const p of patients) {
try {
const r = await svc.recompute({
......
......@@ -112,6 +112,9 @@ export class SyncIncrementalSchedulerService {
const pids = affected.map((p) => p.patientId).filter((p): p is string => !!p);
let ok = 0;
let failed = 0;
// 串行:persona 重算是 **Node-CPU-bound**(16 特征 JS 计算占主),实测 conc=8 不提速、
// 还因竞争略慢(本地 300 患者 30s→32s)。异步并发只能重叠 I/O,重叠不了单线程 CPU。
// 真要提速需 profile 特征计算或多进程/worker,不在此处做。
for (const pid of pids) {
try {
await this.persona.recompute({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment