Fix yarte fixed bench
This commit is contained in:
parent
dad577db8b
commit
86658d4a96
|
@ -1,3 +1,5 @@
|
|||
use std::mem::MaybeUninit;
|
||||
|
||||
use yarte::TemplateFixed;
|
||||
|
||||
pub fn big_table(b: &mut criterion::Bencher<'_>, size: &usize) {
|
||||
|
@ -11,13 +13,11 @@ pub fn big_table(b: &mut criterion::Bencher<'_>, size: &usize) {
|
|||
}
|
||||
let ctx = BigTable { table };
|
||||
b.iter(|| {
|
||||
let mut buf = String::with_capacity(109915);
|
||||
unsafe {
|
||||
buf.as_mut_vec().set_len(109915);
|
||||
let b = ctx.call(buf.as_bytes_mut()).unwrap();
|
||||
buf.as_mut_vec().set_len(b);
|
||||
let mut buf: [u8; 109915] = MaybeUninit::uninit().assume_init();
|
||||
let b = ctx.call(&mut buf).unwrap();
|
||||
let _ = &buf[..b];
|
||||
}
|
||||
buf
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -51,13 +51,11 @@ pub fn teams(b: &mut criterion::Bencher<'_>) {
|
|||
],
|
||||
};
|
||||
b.iter(|| {
|
||||
let mut buf = String::with_capacity(239);
|
||||
unsafe {
|
||||
buf.as_mut_vec().set_len(239);
|
||||
let b = teams.call(buf.as_bytes_mut()).unwrap();
|
||||
buf.as_mut_vec().set_len(b);
|
||||
let mut buf: [u8; 239] = MaybeUninit::uninit().assume_init();
|
||||
let b = teams.call(&mut buf).unwrap();
|
||||
let _ = &buf[..b];
|
||||
}
|
||||
buf
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
<table>{{#each table}}<tr>{{#each this}}<td>{{ this }}</td>{{/each}}</tr>{{/each}}</table>
|
||||
<table>{{#each table}}<tr>{{#each this}}<td>{{ this }}</td>{{/each }}</tr>{{/each }}</table>
|
||||
|
|
|
@ -1 +1 @@
|
|||
<html><head><title>{{ year }}</title></head><body><h1>CSL {{ year }}</h1><ul>{{#each teams }}<li class="{{#if index0 == 0 }}champion{{/if}}"><b>{{ name }}</b>: {{ score }}</li>{{/each}}</ul></body></html>
|
||||
<html><head><title>{{ year }}</title></head><body><h1>CSL {{ year }}</h1><ul>{{#each teams }}<li class="{{#if first }}champion{{/if }}"><b>{{ name }}</b>: {{ score }}</li>{{/each }}</ul></body></html>
|
||||
|
|
Loading…
Reference in New Issue