Files
Manish Goregaokar 913feede34 Fix and rerun rustfmt
2022-03-24 10:42:50 -07:00

36 lines
1.1 KiB
Rust

// Copyright 2017 The Servo Project Developers. See the
// COPYRIGHT file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! Profiling example
#[cfg(feature = "flame_it")]
fn main() {
use std::fs::File;
use unicode_bidi::BidiInfo;
const BIDI_TEXT: &str = include_str!("../data/udhr/bidi/udhr_pes_1.txt");
flame::start("main(): BidiInfo::new()");
let bidi_info = BidiInfo::new(BIDI_TEXT, None);
flame::end("main(): BidiInfo::new()");
flame::start("main(): iter bidi_info.paragraphs");
for para in &bidi_info.paragraphs {
let line = para.range.clone();
bidi_info.reorder_line(para, line);
}
flame::end("main(): iter bidi_info.paragraphs");
flame::dump_html(&mut File::create("flame-udhr-graph.html").unwrap()).unwrap();
}
#[cfg(not(feature = "flame_it"))]
// Allow example to compile
fn main() {}