]>
git.proxmox.com Git - rustc.git/blob - vendor/pulldown-cmark-0.7.2/benches/lib.rs
3 extern crate pulldown_cmark
;
7 use pulldown_cmark
::{html, Options, Parser}
;
9 fn render_html(text
: &str, opts
: Options
) -> String
{
10 let mut s
= String
::with_capacity(text
.len() * 3 / 2);
11 let p
= Parser
::new_ext(text
, opts
);
12 html
::push_html(&mut s
, p
);
17 fn pathological_codeblocks1(b
: &mut test
::Bencher
) {
18 // Note that `buf` grows quadratically with number of
19 // iterations. The point here is that the render time shouldn't
20 // grow faster than that.
21 let mut buf
= String
::new();
29 b
.iter(|| render_html(&buf
, Options
::empty()));
33 fn advanced_pathological_codeblocks(b
: &mut test
::Bencher
) {
34 let mut buf
= String
::new();
36 while buf
.len() < 1250 {
43 for _
in 0..buf
.len() {
47 b
.iter(|| render_html(&buf
, Options
::empty()));