1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Pass around Arc<Galley> to avoid copying a lot of data

This commit is contained in:
Emil Ernerfeldt
2021-03-29 22:30:18 +02:00
parent 94baf98eab
commit 1c60dc8d66
6 changed files with 33 additions and 20 deletions

View File

@@ -75,9 +75,12 @@ pub fn criterion_benchmark(c: &mut Criterion) {
egui::FontDefinitions::default(),
);
let font = &fonts[text_style];
c.bench_function("text layout", |b| {
c.bench_function("text layout (uncached)", |b| {
b.iter(|| font.layout_multiline(LOREM_IPSUM_LONG.to_owned(), wrap_width))
});
c.bench_function("text layout (cached)", |b| {
b.iter(|| fonts.layout_multiline(text_style, LOREM_IPSUM_LONG.to_owned(), wrap_width))
});
let galley = font.layout_multiline(LOREM_IPSUM_LONG.to_owned(), wrap_width);
let mut tessellator = egui::epaint::Tessellator::from_options(Default::default());