需要优化一下大repo的性能 #2
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
生产环境有人上传了一个claude code源代码。我看,全局视图挺慢的,我们不能lazy load资源么?
而且,块块的字体很大,不对劲
@ms 帮忙看一下
PR 开好了:#5
分析了两个问题,都动刀了:
字体太大 —
Math.min(leaf.w, leaf.h) * 0.15没有上限,大 tile 直接算出 20+ world units 的字号。加了个Math.min(..., 5)的 cap,一行搞定。全局视图慢 — 根因是两处叠加:
load()里对每个文件同步跑computeColorRanges(highlight.js),几百个文件直接把主线程卡死改法:
GET /api/repos/{key}/file?path=...按需拉单文件内容(cache 里内容还在,不影响任何逻辑)_showCode()发现 content 为空就异步 fetch,拿到之后再计算 colorRanges,loading标志防重复请求Rust 编译通过无报错,3 个文件改动。