use criterion::{criterion_group, criterion_main, Criterion};
use htmlentity::entity::{decode, encode};
fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("encode", |b| {
b.iter(|| {
encode(
r##"
<div class="s-rank-title">
<a href="http://top.baidu.com/?fr=mhd_card" target="_blank">
<div class="title-text c-font-medium c-color-t">
热榜
</div>
</a>
<a class="hot-refresh c-font-normal c-color-gray2">
<i class="c-icon"></i><span class="hot-refresh-text">换一换</span>
</a>
</div>
"##
.as_bytes(),
&Default::default(),
&Default::default(),
);
})
});
c.bench_function("decode", |b| {
b.iter(|| {
decode(r##"
<div class="s-rank-title">
        <a href="http://www.abc.com/?fr=mhd_card" target="_blank">
            <div class="title-text c-font-medium c-color-t">
                热榜
            </div>
        </a>
        <a class="hot-refresh c-font-normal c-color-gray2"> 
            <i class="c-icon">&#xe619;</i><span class="hot-refresh-text">换一换</span>
        </a>
    </div>
"##.as_bytes());
})
});
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);