From 1dc23ffddef7ab07e48c1d4012b1b66da0c2afb0 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Sat, 22 Aug 2026 08:05:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(tpc):=20llc=20=E7=BC=96=E8=AF=91=E9=98=B6?= =?UTF-8?q?=E6=AE=B5=E6=97=A5=E5=BF=97=E5=B8=A6=E8=BF=9B=E5=BA=A6/?= =?UTF-8?q?=E6=BA=90=E6=96=87=E4=BB=B6/=E8=80=97=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 用户反馈 SUCCESS: xxx.ll 只有 sha1 看不到对应源文件与进度 - 改为 '[i/N] sha1.ll 源文件相对路径 (耗时s)'(sha1_map 反查源文件,提交时刻计时含排队) --- lib/Projectrans/Phase2Translator.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/Projectrans/Phase2Translator.py b/lib/Projectrans/Phase2Translator.py index 44f2b9e..778bdfe 100644 --- a/lib/Projectrans/Phase2Translator.py +++ b/lib/Projectrans/Phase2Translator.py @@ -2091,14 +2091,23 @@ class Phase2Translator: n_workers = _PickWorkerCount(len(need_compile), 400) _vlog().info(f" 并行编译 {len(need_compile)} 个文件 (workers={n_workers})") errors = [] + _compile_total = len(need_compile) + _compile_done = 0 with ThreadPoolExecutor(max_workers=n_workers) as executor: - futures = {executor.submit(_compile_one, ll_path): ll_path for ll_path in need_compile} + futures = {} + for ll_path in need_compile: + futures[executor.submit(_compile_one, ll_path)] = (ll_path, time.time()) for future in as_completed(futures): + ll_path, _t_sub = futures[future] rel, status, err = future.result() + _compile_done += 1 + _elapsed_c = time.time() - _t_sub + _sha1_c = os.path.basename(ll_path)[:-3] + _src_c = self.sha1_map.get(_sha1_c, '?') if status == 'ok': - _vlog().success(f" {rel}") + _vlog().success(f" [{_compile_done}/{_compile_total}] {os.path.basename(ll_path)} {_src_c} ({_elapsed_c:.1f}s)") elif status == 'error': - _vlog().error(f" {rel}: {err}") + _vlog().error(f" [{_compile_done}/{_compile_total}] {rel}: {err}") errors.append((rel, err)) elif status == 'cached': pass