Skip to content

Commit

Permalink
Directly interfere to start kern sooner
Browse files Browse the repository at this point in the history
  • Loading branch information
rsheeter committed Nov 10, 2023
1 parent a53e522 commit 40d3684
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion fontc/src/workload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,15 @@ impl<'a> Workload<'a> {
.queued()
.run();

let launchable: Vec<_> = self
let mut has_kern = false;
let mut launchable: Vec<_> = self
.jobs_pending
.iter()
.filter_map(|(id, job)| {
if !job.running && self.can_run(job) {
if matches!(id, AnyWorkId::Fe(FeWorkIdentifier::Kerning)) {
has_kern = true;
}
Some(id.clone())
} else {
None
Expand All @@ -246,6 +250,12 @@ impl<'a> Workload<'a> {
.collect();
trace!("Launchable: {launchable:?}");

// https://github.com/googlefonts/fontc/issues/456: try to avoid kern as long pole
if has_kern {
let kern_idx = launchable.iter().position(|id| matches!(id, AnyWorkId::Fe(FeWorkIdentifier::Kerning))).unwrap();
launchable.swap(0, kern_idx);
}

self.timing.add(timing.complete());
launchable
}
Expand Down

0 comments on commit 40d3684

Please sign in to comment.