Reuse project directory indexes within a revision

This commit is contained in:
gloamxun committed 2026-11-19 18:14:31 +08:00
1 parent 41af3d8d22
commit ab50ca7dad
2 files changed
+45 -5

No files matched your search

+19 -5
View File
@@ -499,6 +499,7 @@ impl InputSnapshot {
pub struct FileWorld {
config: WorldConfig,
indexes: BTreeMap<PathBuf, Arc<DirectoryIndex>>,
current_project_indexes: BTreeSet<PathBuf>,
index_failures: BTreeMap<PathBuf, DirectoryFailure>,
trace: ResourceTrace,
pinned: bool,
@@ -633,6 +634,7 @@ impl FileWorld {
Ok(Self {
config,
indexes: BTreeMap::new(),
current_project_indexes: BTreeSet::new(),
index_failures: BTreeMap::new(),
trace,
pinned: false,
@@ -672,6 +674,7 @@ impl FileWorld {
Ok(Self {
config,
indexes: BTreeMap::new(),
current_project_indexes: BTreeSet::new(),
index_failures: BTreeMap::new(),
trace,
pinned: true,
@@ -748,6 +751,7 @@ impl FileWorld {
Ok(Self {
config,
indexes: snapshot.indexes.clone(),
current_project_indexes: BTreeSet::new(),
index_failures: snapshot.index_failures.clone(),
trace,
pinned: true,
@@ -803,7 +807,9 @@ impl FileWorld {
path.display()
));
}
self.live_paths.insert(path.to_owned());
if self.live_paths.insert(path.to_owned()) && self.project.is_some() {
self.current_project_indexes.clear();
}
}
pub fn mark_generated_initial(&mut self, path: &Path) -> Result<(), String> {
if self
@@ -826,7 +832,10 @@ impl FileWorld {
let was_live = self.live_paths.remove(&resource.version.path);
if self.pinned {
if was_live || self.project.is_some() {
self.protected_paths.insert(resource.version.path.clone());
let newly_protected = self.protected_paths.insert(resource.version.path.clone());
if self.project.is_some() && (was_live || newly_protected) {
self.current_project_indexes.clear();
}
}
if was_live {
self.replay_gaps.push(format!(
@@ -1243,9 +1252,14 @@ impl FileWorld {
}
fn index(&mut self, root: &Path) -> Result<&DirectoryIndex, String> {
if let Some(project) = &self.project {
let index =
project.index(root, &self.project_paths(), self.config.max_index_entries)?;
self.indexes.insert(root.into(), Arc::new(index));
// The index tracks the logical namespace. Each candidate's live
// existence and staged bytes are still checked by probe().
if !self.current_project_indexes.contains(root) {
let index =
project.index(root, &self.project_paths(), self.config.max_index_entries)?;
self.indexes.insert(root.into(), Arc::new(index));
self.current_project_indexes.insert(root.into());
}
return Ok(&self.indexes[root]);
}
if self.pinned {
+26
View File
@@ -386,6 +386,32 @@ WSL I/O 压力 some avg10 从2.73%到34.67%。此场景的取消上界 p95 低
`directed-final.log` 的 SHA-256 为
`90b907c33458cc109effdf696721d9ddc572fbd43f3a1dc05694fb986b49330f`。
### 同一修订中的资源目录索引
对于冻结了文件树的项目,同一编译准备及执行过程中复用同一根目录的索引。
路径在可变文件与受保护文件之间的角色更新时,相关索引重新生成。每次查找
仍按当前生成文件和私有写入状态检验候选文件。70 项资源、快照和原生作业
回归通过。
原样 A4 同一机器、同一原版格式及字体,两版各有30次主文件和30次子文件
的真实 Edge 输入。两版都允许文件同步期间绘制。按每次修订比较执行步数、
复用步数、PDF、SVG 和来源版本与映射,全部相同,最终 aux 相同。独立全量
使用同版优化程序和实际末次未保存缓冲区,零复用步骤,得到相同输出。
| 编辑范围 | 基线准备 p50 / p95 (ms) | 新版准备 p50 / p95 (ms) | 基线绘制 p50 / p95 (ms) | 新版绘制 p50 / p95 (ms) |
| --- | ---: | ---: | ---: | ---: |
| 主文件正文 | 66.7 / 105.5 | 63.9 / 78.1 | 276.7 / 402.9 | 265.6 / 321.0 |
| 子文件正文 | 67.0 / 106.0 | 63.3 / 80.0 | 296.0 / 362.1 | 284.3 / 338.7 |
峰值 RSS 分别为 630020 和 630028 KiB。
WSL I/O 压力 some avg10 从8.19%到20.84%。两类可见延迟均需继续缩短。
`target/p4-project-index-main` 内浏览器回执 `edge-a4/run-1/receipt.json`
SHA-256 为 `b0d0ba06fa38a4b7a2b404be2e5e8a5dddd4256382cc41c3cfa11f299600b654`,独立全量回执
`full-equivalence/receipt.json` SHA-256 为
`ea236e14b3d7e1a3808169d818945dbe7d1f60e94a1717b7cf534328efb8174a`,回归日志
`directed.log` SHA-256 为
`2592b8dfb81a028fc88155e4b421b4e11313ea4beca07b7444ef4560d31280c1`。
### schema27 与主线兼容性
合并了真实重复盒及 PDF 书签布局,并保留主线的宏参数分隔符和流式失败报告。