Faster constraint checking in comemo (bumps comemo & krilla) (#6683)
This commit is contained in:
parent
88dfe4d276
commit
492bd27885
|
|
@ -450,21 +450,22 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
|||
|
||||
[[package]]
|
||||
name = "comemo"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df6916408a724339aa77b18214233355f3eb04c42eb895e5f8909215bd8a7a91"
|
||||
checksum = "649d7b2d867b569729c03c0f6968db10bc95921182a1f2b2012b1b549492f39d"
|
||||
dependencies = [
|
||||
"comemo-macros",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"rustc-hash",
|
||||
"siphasher",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "comemo-macros"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c8936e42f9b4f5bdfaf23700609ac1f11cb03ad4c1ec128a4ee4fd0903e228db"
|
||||
checksum = "51c87fc7e85487493ddedae1a3a34b897c77ad8825375b79265a8a162c28d535"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -861,15 +862,6 @@ version = "2.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
|
||||
|
||||
[[package]]
|
||||
name = "fxhash"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getopts"
|
||||
version = "0.2.21"
|
||||
|
|
@ -1424,14 +1416,13 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "krilla"
|
||||
version = "0.4.0"
|
||||
source = "git+https://github.com/LaurenzV/krilla?rev=37b9a00#37b9a00bfac87ed0b347b7cf8e9d37a6f68fcccd"
|
||||
source = "git+https://github.com/LaurenzV/krilla?rev=abdf031#abdf031c9e5ba89d606f6f145fad648c75812aec"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bumpalo",
|
||||
"comemo",
|
||||
"flate2",
|
||||
"float-cmp 0.10.0",
|
||||
"fxhash",
|
||||
"gif",
|
||||
"hayro-write",
|
||||
"image-webp",
|
||||
|
|
@ -1440,6 +1431,7 @@ dependencies = [
|
|||
"pdf-writer",
|
||||
"png",
|
||||
"rayon",
|
||||
"rustc-hash",
|
||||
"rustybuzz",
|
||||
"siphasher",
|
||||
"skrifa",
|
||||
|
|
@ -1454,7 +1446,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "krilla-svg"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/LaurenzV/krilla?rev=37b9a00#37b9a00bfac87ed0b347b7cf8e9d37a6f68fcccd"
|
||||
source = "git+https://github.com/LaurenzV/krilla?rev=abdf031#abdf031c9e5ba89d606f6f145fad648c75812aec"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"fontdb",
|
||||
|
|
@ -2270,9 +2262,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "2.1.0"
|
||||
version = "2.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497"
|
||||
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
|
|
@ -2499,6 +2491,12 @@ dependencies = [
|
|||
"read-fonts",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d"
|
||||
|
||||
[[package]]
|
||||
name = "slotmap"
|
||||
version = "1.0.7"
|
||||
|
|
@ -2588,11 +2586,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "subsetter"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "35539e8de3dcce8dd0c01f3575f85db1e5ac1aea1b996d2d09d89f148bc91497"
|
||||
checksum = "35725d9d2d056905865f8a36146e45be43691b15fc5d973bd7f79dd438288544"
|
||||
dependencies = [
|
||||
"fxhash",
|
||||
"rustc-hash",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ clap_mangen = "0.2.10"
|
|||
codespan-reporting = "0.11"
|
||||
codex = { git = "https://github.com/typst/codex", rev = "9ac86f9" }
|
||||
color-print = "0.3.6"
|
||||
comemo = "0.4"
|
||||
comemo = "0.5.0"
|
||||
csv = "1"
|
||||
ctrlc = "3.4.1"
|
||||
dirs = "6"
|
||||
|
|
@ -75,8 +75,8 @@ image = { version = "0.25.5", default-features = false, features = ["png", "jpeg
|
|||
indexmap = { version = "2", features = ["serde"] }
|
||||
infer = { version = "0.19.0", default-features = false }
|
||||
kamadak-exif = "0.6"
|
||||
krilla = { git = "https://github.com/LaurenzV/krilla", rev = "37b9a00", default-features = false, features = ["raster-images", "comemo", "rayon", "pdf"] }
|
||||
krilla-svg = { git = "https://github.com/LaurenzV/krilla", rev = "37b9a00"}
|
||||
krilla = { git = "https://github.com/LaurenzV/krilla", rev = "abdf031", default-features = false, features = ["raster-images", "comemo", "rayon", "pdf"] }
|
||||
krilla-svg = { git = "https://github.com/LaurenzV/krilla", rev = "abdf031" }
|
||||
kurbo = "0.11"
|
||||
libfuzzer-sys = "0.4"
|
||||
lipsum = "0.9"
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
use comemo::{Track, Tracked, TrackedMut, Validate};
|
||||
use comemo::{Track, Tracked, TrackedMut};
|
||||
use ecow::EcoVec;
|
||||
use rayon::iter::{IndexedParallelIterator, IntoParallelIterator, ParallelIterator};
|
||||
use rustc_hash::FxHashSet;
|
||||
|
|
@ -219,7 +219,7 @@ pub struct Route<'a> {
|
|||
// We need to override the constraint's lifetime here so that `Tracked` is
|
||||
// covariant over the constraint. If it becomes invariant, we're in for a
|
||||
// world of lifetime pain.
|
||||
outer: Option<Tracked<'a, Self, <Route<'static> as Validate>::Constraint>>,
|
||||
outer: Option<Tracked<'a, Self, <Route<'static> as Track>::Call>>,
|
||||
/// This is set if this route segment was inserted through the start of a
|
||||
/// module evaluation.
|
||||
id: Option<FileId>,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::fmt::{self, Debug, Formatter};
|
|||
use std::hash::Hash;
|
||||
use std::sync::OnceLock;
|
||||
|
||||
use comemo::{Tracked, Validate};
|
||||
use comemo::{Track, Tracked};
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use crate::introspection::{Introspector, Location};
|
||||
|
|
@ -312,7 +312,7 @@ enum LinkKind<'a> {
|
|||
/// We need to override the constraint's lifetime here so that `Tracked` is
|
||||
/// covariant over the constraint. If it becomes invariant, we're in for a
|
||||
/// world of lifetime pain.
|
||||
Outer(Tracked<'a, Locator<'a>, <Locator<'static> as Validate>::Constraint>),
|
||||
Outer(Tracked<'a, Locator<'a>, <Locator<'static> as Track>::Call>),
|
||||
/// A link which indicates that we are in measurement mode.
|
||||
Measure(Location),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
use std::collections::BTreeMap;
|
||||
use std::num::NonZeroU64;
|
||||
|
||||
use ecow::{EcoVec, eco_format};
|
||||
use krilla::annotation::Annotation;
|
||||
|
|
@ -626,8 +625,7 @@ fn convert_error(
|
|||
|
||||
/// Convert a krilla location to a span.
|
||||
fn to_span(loc: Option<krilla::surface::Location>) -> Span {
|
||||
loc.map(|l| Span::from_raw(NonZeroU64::new(l).unwrap()))
|
||||
.unwrap_or(Span::detached())
|
||||
loc.map(Span::from_raw).unwrap_or(Span::detached())
|
||||
}
|
||||
|
||||
fn collect_named_destinations(
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ pub(crate) fn embed_files(
|
|||
association_kind,
|
||||
data: data.into(),
|
||||
compress,
|
||||
location: Some(span.into_raw().get()),
|
||||
location: Some(span.into_raw()),
|
||||
};
|
||||
|
||||
if document.embed_file(file).is_none() {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ pub(crate) fn handle_image(
|
|||
span: Span,
|
||||
) -> SourceResult<()> {
|
||||
surface.push_transform(&fc.state().transform().to_krilla());
|
||||
surface.set_location(span.into_raw().get());
|
||||
surface.set_location(span.into_raw());
|
||||
|
||||
let interpolate = image.scaling() == Smart::Custom(ImageScaling::Smooth);
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ pub(crate) fn handle_shape(
|
|||
gc: &mut GlobalContext,
|
||||
span: Span,
|
||||
) -> SourceResult<()> {
|
||||
surface.set_location(span.into_raw().get());
|
||||
surface.set_location(span.into_raw());
|
||||
surface.push_transform(&fc.state().transform().to_krilla());
|
||||
|
||||
if let Some(path) = convert_geometry(&shape.geometry) {
|
||||
|
|
|
|||
|
|
@ -132,6 +132,6 @@ impl krilla::text::Glyph for PdfGlyph {
|
|||
}
|
||||
|
||||
fn location(&self) -> Option<Location> {
|
||||
Some(self.0.span.0.into_raw().get())
|
||||
Some(self.0.span.0.into_raw())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ pub use typst_utils as utils;
|
|||
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use comemo::{Track, Tracked, Validate};
|
||||
use comemo::{Track, Tracked};
|
||||
use ecow::{EcoString, EcoVec, eco_format, eco_vec};
|
||||
use rustc_hash::FxHashSet;
|
||||
use typst_html::HtmlDocument;
|
||||
|
|
@ -135,7 +135,7 @@ fn compile_impl<D: Document>(
|
|||
|
||||
subsink = Sink::new();
|
||||
|
||||
let constraint = <Introspector as Validate>::Constraint::new();
|
||||
let constraint = comemo::Constraint::new();
|
||||
let mut engine = Engine {
|
||||
world,
|
||||
introspector: introspector.track_with(&constraint),
|
||||
|
|
@ -150,7 +150,7 @@ fn compile_impl<D: Document>(
|
|||
introspector = document.introspector();
|
||||
iter += 1;
|
||||
|
||||
if timed!("check stabilized", introspector.validate(&constraint)) {
|
||||
if timed!("check stabilized", constraint.validate(introspector)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue