Avoid extra copies while assembling relocated TeX suffixes
This commit is contained in:
1 parent
5b9eca1d60
commit
5b86a7ac7e
5 files changed
+90
-38
No files matched your search
@@ -221,6 +221,8 @@ impl EntryCheckpoint {
|
||||
// The joined events are published results. Resumption always starts
|
||||
// from a live checkpoint, whose original shared allocations stay intact.
|
||||
let execution = measure(timings.map(|timings| &mut timings.suffix_assembly), || {
|
||||
let mut events = Vec::with_capacity(completed.events.len());
|
||||
events.extend(current.events.iter().cloned());
|
||||
let mut execution = Execution {
|
||||
format_dumped: completed.format_dumped,
|
||||
format_pdf_images: completed.format_pdf_images.clone(),
|
||||
@@ -229,7 +231,7 @@ impl EntryCheckpoint {
|
||||
native_page: completed.native_page.clone(),
|
||||
split_discards: completed.split_discards.clone(),
|
||||
after_assignment: completed.after_assignment.clone(),
|
||||
events: current.events.clone().into_vec(),
|
||||
events,
|
||||
state: completed.state.clone(),
|
||||
io: completed.io.clone(),
|
||||
input_position: completed.input_position,
|
||||
|
||||
@@ -75,11 +75,11 @@ pub(super) fn same_kernel_provenance(
|
||||
let mut discards = prior.split_discards.clone();
|
||||
let mut native_page = prior.native_page.clone();
|
||||
let mut pending_shipouts = prior.pending_shipouts.clone();
|
||||
relocate_vertical(&mut vertical.nodes, relocation)?;
|
||||
relocate_vertical(&mut discards, relocation)?;
|
||||
relocation.relocate_vertical(&mut vertical.nodes)?;
|
||||
relocation.relocate_vertical(&mut discards)?;
|
||||
relocate_page(&mut native_page, relocation)?;
|
||||
for value in &mut pending_shipouts {
|
||||
*value = relocation.relocate_box(value)?;
|
||||
relocation.relocate_box(value)?;
|
||||
}
|
||||
if current.generated_inputs != generated
|
||||
|| current.conditionals != conditionals
|
||||
@@ -130,7 +130,7 @@ pub(super) fn append_suffix(
|
||||
}
|
||||
execution.state.relocate_source(relocation)?;
|
||||
relocate_page(&mut execution.native_page, relocation)?;
|
||||
relocate_vertical(&mut execution.split_discards, relocation)?;
|
||||
relocation.relocate_vertical(&mut execution.split_discards)?;
|
||||
if let Some(token) = &mut execution.after_assignment {
|
||||
relocation.relocate_token(token)?;
|
||||
}
|
||||
@@ -156,10 +156,10 @@ fn relocate_page(
|
||||
relocation: &mut EventRelocation<'_>,
|
||||
) -> Option<()> {
|
||||
if let Some(page) = page {
|
||||
relocate_vertical(&mut page.nodes, relocation)?;
|
||||
relocate_vertical(page.contributions.make_contiguous(), relocation)?;
|
||||
relocate_vertical(&mut page.discards, relocation)?;
|
||||
relocate_vertical(&mut page.insertions.held, relocation)?;
|
||||
relocation.relocate_vertical(&mut page.nodes)?;
|
||||
relocation.relocate_vertical(page.contributions.make_contiguous())?;
|
||||
relocation.relocate_vertical(&mut page.discards)?;
|
||||
relocation.relocate_vertical(&mut page.insertions.held)?;
|
||||
}
|
||||
Some(())
|
||||
}
|
||||
@@ -170,13 +170,3 @@ fn relocate_tokens(tokens: &mut [Token], relocation: &mut EventRelocation<'_>) -
|
||||
}
|
||||
Some(())
|
||||
}
|
||||
|
||||
fn relocate_vertical(
|
||||
nodes: &mut [NativeVerticalNode],
|
||||
relocation: &mut EventRelocation<'_>,
|
||||
) -> Option<()> {
|
||||
for node in nodes {
|
||||
*node = relocation.relocate_vertical(node)?;
|
||||
}
|
||||
Some(())
|
||||
}
|
||||
Reference in new issue
Block a user