From 75f824341b654bf1d66713730009fcb1bcc0d0b5 Mon Sep 17 00:00:00 2001 From: claude_dev Date: Tue, 25 Aug 2026 23:56:44 +0800 Subject: [PATCH] =?UTF-8?q?perf(factor):=20=E5=9B=A0=E5=AD=90=E7=9F=A9?= =?UTF-8?q?=E9=98=B5=E5=AE=BD=E8=A1=A8=E5=8C=96polars=20pivot=E6=94=B9pand?= =?UTF-8?q?as=20pivot=E2=80=94=E2=80=94py-spy=E5=AE=9E=E9=94=A410.4M?= =?UTF-8?q?=E8=A1=8Cpolars=20pivot=E5=8D=95=E6=AC=A110+=E5=88=86=E9=92=9F,?= =?UTF-8?q?=E5=94=AF=E4=B8=80=E9=94=AE=E4=B8=8Bpandas=3Dfactorize+reshape?= =?UTF-8?q?=E7=A7=92=E7=BA=A7;=E7=B4=A2=E5=BC=95/=E5=88=97=E8=AF=AD?= =?UTF-8?q?=E4=B9=89=E4=B8=8E=E5=90=8E=E7=BB=AD=E5=88=87=E7=AA=97=E6=8E=A9?= =?UTF-8?q?=E7=A0=81=E4=B8=8D=E5=8F=98=20[vps]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sanguo_factor/batch_eval.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sanguo_factor/batch_eval.py b/sanguo_factor/batch_eval.py index 13c8c9b..456eab9 100644 --- a/sanguo_factor/batch_eval.py +++ b/sanguo_factor/batch_eval.py @@ -144,9 +144,11 @@ def _eval_one(name: str, alpha_df: pl.DataFrame, cutoff_map: dict[str, _dt], # 优化:先 pivot 全表,再 pandas 切窗口+预热期广播掩码置 NaN(替代 per-factor hash join) # 语义等价性:join 版把「窗口外或 bar_idx