diff --git a/crates/hdx_transform/benches/minify_popular.rs b/crates/hdx_transform/benches/minify_popular.rs index a4dbcf04..175d1c91 100644 --- a/crates/hdx_transform/benches/minify_popular.rs +++ b/crates/hdx_transform/benches/minify_popular.rs @@ -1,9 +1,8 @@ use bumpalo::Bump; use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; -use css_ast::css::{visit::VisitableMut, StyleSheet}; -use css_parse::{Features, Parser}; +use css_ast::{VisitableMut, StyleSheet}; +use css_parse::{CursorFmtSink, Parser, ToCursors}; use glob::glob; -use hdx_transform::ReduceInitial; #[cfg(target_family = "unix")] use pprof::criterion::{Output, PProfProfiler}; use std::fs::read_to_string; @@ -32,20 +31,19 @@ fn popular(c: &mut Criterion) { group.throughput(Throughput::Bytes(file.source_text.len() as u64)); group.bench_with_input(BenchmarkId::from_parameter(&file.name), &file.source_text, |b, source_text| { b.iter_with_large_drop(|| { - let allocator = Bump::default(); + let bump = Bump::default(); { - let mut result = Parser::new(&allocator, source_text.as_str(), Features::default()) - .parse_entirely::(); - let mut string = String::new(); + let mut result = Parser::new(&bump, source_text.as_str()).parse_entirely::(); + let mut string = bumpalo::collections::String::new_in(&bump); if let Some(stylesheet) = result.output.as_mut() { - let mut transformer = ReduceInitial::default(); - stylesheet.accept_mut(&mut transformer); - if let Err(e) = stylesheet.write_css(&mut writer) { - println!("Failed to write CSS: {:?}", e); - } + // let mut transformer = ReduceInitial::default(); + // TODO! Re-introduce minifyer + // stylesheet.accept_mut(&mut transformer); + let mut sink = CursorFmtSink::new(&file.source_text, &mut string); + stylesheet.to_cursors(&mut sink); } } - allocator + bump }); }); }