Reuse cached layouts for relocated native shipouts
This commit is contained in:
1 parent
41a459b4ca
commit
57c05d9635
8 files changed
+394
-26
No files matched your search
+19
-10
@@ -1127,9 +1127,9 @@ impl CompileJob {
|
||||
evidence.phase = AttemptPhase::Executing;
|
||||
let cache = &self.compiler.line_break_cache;
|
||||
let before = cache.work();
|
||||
let (executed, next_checkpoint) = if let Some(current) = active_checkpoint {
|
||||
let (executed, next_checkpoint, reused_layouts) = if let Some(current) = active_checkpoint {
|
||||
debug_assert!(executor.is_none());
|
||||
let (executed, next) = current.resume(
|
||||
let (executed, next, reused_layouts) = current.resume(
|
||||
&request,
|
||||
&self.job,
|
||||
source,
|
||||
@@ -1139,7 +1139,7 @@ impl CompileJob {
|
||||
allow_suffix,
|
||||
suffix_failure,
|
||||
)?;
|
||||
(executed, Some(next))
|
||||
(executed, Some(next), reused_layouts)
|
||||
} else {
|
||||
let executor = executor
|
||||
.expect("fresh native job has an executor")
|
||||
@@ -1150,9 +1150,9 @@ impl CompileJob {
|
||||
if let Some(snapshot) = &captured {
|
||||
snapshot.report_capture(&mut entry_checkpoint_work);
|
||||
}
|
||||
(executed, captured)
|
||||
(executed, captured, None)
|
||||
} else {
|
||||
(self.job.run_detailed(executor, source, files), None)
|
||||
(self.job.run_detailed(executor, source, files), None, None)
|
||||
}
|
||||
};
|
||||
let execution = match executed {
|
||||
@@ -1191,18 +1191,27 @@ impl CompileJob {
|
||||
== Target::Shipouts
|
||||
{
|
||||
use texrra_tex_core::execution::Event;
|
||||
let relocated_suffix = prior_layout.as_ref().and_then(|prior| {
|
||||
reused_layouts.as_ref()
|
||||
.filter(|reused| Arc::ptr_eq(&prior.execution, &reused.donor))
|
||||
.map(|reused| &reused.suffix)
|
||||
});
|
||||
let mut old = prior_layout.as_deref().into_iter().flat_map(|prior| {
|
||||
prior.execution.execution.events.iter().filter_map(|event| {
|
||||
if let Event::Shipout(page) = event { Some(page.as_ref()) } else { None }
|
||||
}).zip(&prior.shipout_layouts)
|
||||
});
|
||||
}).enumerate();
|
||||
let pages = e.shipout_display_lists_with(|page| {
|
||||
if let Some((_, layout)) =
|
||||
old.next().filter(|(prior, _)| page.shares_local_layout_with(prior))
|
||||
{
|
||||
let reused = old.next().and_then(|(index, (prior, layout))| {
|
||||
relocated_suffix
|
||||
.and_then(|suffix| suffix.relocate_layout(index, layout))
|
||||
.map(Arc::new)
|
||||
.or_else(|| page.shares_local_layout_with(prior).then(|| layout.clone()))
|
||||
});
|
||||
if let Some(layout) = reused {
|
||||
shipout_layout_work.reused_pages += 1;
|
||||
shipout_layouts.push(layout.clone());
|
||||
return Ok((**layout).clone());
|
||||
return Ok((*layout).clone());
|
||||
}
|
||||
let layout = page.display_list()?;
|
||||
shipout_layout_work.lowered_pages += 1;
|
||||
|
||||
Reference in new issue
Block a user