summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-03-07 10:50:03 +0100
committerGitHub <noreply@github.com>2024-03-07 09:50:03 +0000
commit5dc6ce0022ef5bc83464b2dfefb20d608168df20 (patch)
treebc9a7acddde1202a3356650c30e4b62a1e8cf27d
parentcf2f789c07b64cd59f472dfd64877be44c9337d2 (diff)
Remove unmaintained benchmarks (#3569)
-rw-r--r--Cargo.lock9
-rw-r--r--Cargo.toml1
-rw-r--r--tests/Cargo.toml6
-rw-r--r--tests/src/benches.rs133
4 files changed, 0 insertions, 149 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 5117ab63..e15df7d9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -858,14 +858,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94bf16dd62ea2bec617a6f8a3e1ba03107311783069a647787ac689d1f35321e"
[[package]]
-name = "iai"
-version = "0.1.1"
-source = "git+https://github.com/typst/iai?rev=3f0f927#3f0f92736408ebce6545808b98e0cb2aea89b7dd"
-dependencies = [
- "cfg-if",
-]
-
-[[package]]
name = "iana-time-zone"
version = "0.1.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2789,7 +2781,6 @@ dependencies = [
"clap",
"comemo",
"ecow",
- "iai",
"once_cell",
"oxipng",
"rayon",
diff --git a/Cargo.toml b/Cargo.toml
index 5da58be2..f3a53808 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -50,7 +50,6 @@ fs_extra = "1.3"
hayagriva = "0.5.1"
heck = "0.4"
hypher = "0.1.4"
-iai = { git = "https://github.com/typst/iai", rev = "3f0f927" }
icu_properties = { version = "1.4", features = ["serde"] }
icu_provider = { version = "1.4", features = ["sync"] }
icu_provider_adapters = "1.4"
diff --git a/tests/Cargo.toml b/tests/Cargo.toml
index 2a121067..1f650c97 100644
--- a/tests/Cargo.toml
+++ b/tests/Cargo.toml
@@ -17,7 +17,6 @@ typst-ide = { workspace = true }
clap = { workspace = true }
comemo = { workspace = true }
ecow = { workspace = true }
-iai = { workspace = true }
once_cell = { workspace = true }
oxipng = { workspace = true }
rayon = { workspace = true }
@@ -31,10 +30,5 @@ name = "tests"
path = "src/tests.rs"
harness = false
-[[bench]]
-name = "benches"
-path = "src/benches.rs"
-harness = false
-
[lints]
workspace = true
diff --git a/tests/src/benches.rs b/tests/src/benches.rs
deleted file mode 100644
index 1bcdb528..00000000
--- a/tests/src/benches.rs
+++ /dev/null
@@ -1,133 +0,0 @@
-use comemo::{Prehashed, Track, Tracked};
-use iai::{black_box, main, Iai};
-use typst::diag::FileResult;
-use typst::eval::Tracer;
-use typst::foundations::{Bytes, Datetime};
-use typst::syntax::{FileId, Source};
-use typst::text::{Font, FontBook};
-use typst::visualize::Color;
-use typst::{Library, World};
-use unscanny::Scanner;
-
-const TEXT: &str = include_str!("../typ/compiler/bench.typ");
-
-main!(
- bench_decode,
- bench_scan,
- bench_parse,
- bench_edit,
- bench_eval,
- bench_compile,
- bench_render,
-);
-
-fn bench_decode(iai: &mut Iai) {
- iai.run(|| {
- // We don't use chars().count() because that has a special
- // superfast implementation.
- let mut count = 0;
- let chars = black_box(TEXT).chars();
- for _ in chars {
- count += 1;
- }
- count
- })
-}
-
-fn bench_scan(iai: &mut Iai) {
- iai.run(|| {
- let mut count = 0;
- let mut scanner = Scanner::new(black_box(TEXT));
- while scanner.eat().is_some() {
- count += 1;
- }
- count
- })
-}
-
-fn bench_parse(iai: &mut Iai) {
- iai.run(|| typst::syntax::parse(TEXT));
-}
-
-fn bench_edit(iai: &mut Iai) {
- let mut source = Source::detached(TEXT);
- iai.run(|| black_box(source.edit(1168..1171, "_Uhr_")));
-}
-
-fn bench_eval(iai: &mut Iai) {
- let world = BenchWorld::new();
- let route = typst::engine::Route::default();
- let mut tracer = typst::eval::Tracer::new();
- iai.run(|| {
- typst::eval::eval(world.track(), route.track(), tracer.track_mut(), &world.source)
- .unwrap()
- });
-}
-
-fn bench_compile(iai: &mut Iai) {
- let world = BenchWorld::new();
- let mut tracer = Tracer::new();
- iai.run(|| typst::compile(&world, &mut tracer));
-}
-
-fn bench_render(iai: &mut Iai) {
- let world = BenchWorld::new();
- let mut tracer = Tracer::new();
- let document = typst::compile(&world, &mut tracer).unwrap();
- iai.run(|| typst_render::render(&document.pages[0].frame, 1.0, Color::WHITE))
-}
-
-struct BenchWorld {
- library: Prehashed<Library>,
- book: Prehashed<FontBook>,
- font: Font,
- source: Source,
-}
-
-impl BenchWorld {
- fn new() -> Self {
- let data = typst_assets::fonts().next().unwrap();
- let font = Font::new(Bytes::from_static(data), 0).unwrap();
- let book = FontBook::from_fonts([&font]);
- Self {
- library: Prehashed::new(Library::default()),
- book: Prehashed::new(book),
- font,
- source: Source::detached(TEXT),
- }
- }
-
- fn track(&self) -> Tracked<dyn World> {
- (self as &dyn World).track()
- }
-}
-
-impl World for BenchWorld {
- fn library(&self) -> &Prehashed<Library> {
- &self.library
- }
-
- fn book(&self) -> &Prehashed<FontBook> {
- &self.book
- }
-
- fn main(&self) -> Source {
- self.source.clone()
- }
-
- fn source(&self, _: FileId) -> FileResult<Source> {
- unimplemented!()
- }
-
- fn file(&self, _: FileId) -> FileResult<Bytes> {
- unimplemented!()
- }
-
- fn font(&self, _: usize) -> Option<Font> {
- Some(self.font.clone())
- }
-
- fn today(&self, _: Option<i64>) -> Option<Datetime> {
- unimplemented!()
- }
-}