Skip to content

Commit

Permalink
Merge pull request #562 from googlefonts/fast_kern
Browse files Browse the repository at this point in the history
Directly interfere to start kern sooner
  • Loading branch information
rsheeter authored Nov 10, 2023
2 parents d87337f + 11c73b3 commit 0a00caa
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion fontc/src/workload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,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 @@ -245,6 +249,15 @@ 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.timer.add(timing.complete());
launchable
}
Expand Down

0 comments on commit 0a00caa

Please sign in to comment.