MCPcopy Create free account
hub / github.com/csskit/csskit / popular

Function popular

crates/csskit_transform/benches/minify_popular.rs:29–53  ·  view source on GitHub ↗
(c: &mut Criterion)

Source from the content-addressed store, hash-verified

27}
28
29fn popular(c: &mut Criterion) {
30 let mut group = c.benchmark_group("minify_popular");
31 for file in get_files() {
32 group.throughput(Throughput::Bytes(file.source_text.len() as u64));
33 group.bench_with_input(BenchmarkId::from_parameter(&file.name), &file.source_text, |b, source_text| {
34 b.iter_with_large_drop(|| {
35 let bump = Bump::default();
36 {
37 let lexer = Lexer::new(&CssAtomSet::ATOMS, source_text);
38 let mut result = Parser::new(&bump, source_text.as_str(), lexer).parse_entirely::<StyleSheet>();
39 let mut string = bumpalo::collections::String::new_in(&bump);
40 if let Some(stylesheet) = result.output.as_mut() {
41 // let mut transformer = ReduceInitial::default();
42 // TODO! Re-introduce minifyer
43 // stylesheet.accept_mut(&mut transformer);
44 let mut sink = CursorWriteSink::new(&file.source_text, &mut string);
45 stylesheet.to_cursors(&mut sink);
46 }
47 }
48 bump
49 });
50 });
51 }
52 group.finish();
53}
54
55#[cfg(target_family = "unix")]
56criterion_group! {

Callers

nothing calls this directly

Calls 5

finishMethod · 0.80
get_filesFunction · 0.70
lenMethod · 0.45
as_strMethod · 0.45
to_cursorsMethod · 0.45

Tested by

no test coverage detected