[中] current_frames 每次访问都复制整段 SourceFrame 列表

Open
#21 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
performance

Research direction

Start at windows/birdlock/app/state.py:446-459 where current_frames rebuilds every SourceFrame, then read the two callers: StatusCard.refresh() in preview.py:736 and LookTab.visible_when in inspector.py:531. Confirm what each caller actually needs (a count and first/last file name), then cache that in the state object instead of materialising the list. Done means those callers no longer copy frames on each refresh and the analysis-stage allocation rate with a large frame set stays flat.

Written by the indexing model from the issue text.

Description

位置:windows/birdlock/app/state.py:446-459;windows/birdlock/app/preview.py:736;windows/birdlock/app/inspector.py:531

现象:current_frames 对每个 frame 执行 SourceFrame(**f.__dict__)。StatusCard.refresh() 在 "progress" 上调用它只为拿 len 与首尾文件名;LookTab 的 visible_when 每次 Inspector 刷新也会调用 cache_file(st.current_frames)。3000 帧合并时,分析进度 20 Hz 会产生每秒数万次对象复制。

复现:导入 3000 帧并观察分析阶段的 Python 分配速率。

建议:在状态里缓存当前帧数/首尾文件名,或让 current_frames 只在分析开始时构造一次。

来源:2026-11-15 全仓只读审计,PR #7 未包含此项。 未在 Windows 实机复现,复现路径由代码审计推得。

Dominant language
Swift
Stars
2
Forks
2
Avg merge
1h 11m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cyandee/BirdLock

All issues in cyandee/BirdLock

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.