Update benchmark result

[skip ci]
This commit is contained in:
Kogia-sima 2020-06-07 11:47:13 +09:00
parent 94e7ce2e8a
commit 0a597796bd
7 changed files with 127 additions and 72 deletions

118
benches/Cargo.lock generated
View File

@ -212,9 +212,9 @@ dependencies = [
[[package]]
name = "bumpalo"
version = "3.3.0"
version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5356f1d23ee24a1f785a56d1d1a5f0fd5b0f6a0c0fb2412ce11da71649ab78f6"
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
[[package]]
name = "byteorder"
@ -519,16 +519,21 @@ dependencies = [
[[package]]
name = "dirs-sys"
version = "0.3.4"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b"
checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a"
dependencies = [
"cfg-if",
"libc",
"redox_users",
"winapi",
]
[[package]]
name = "dtoa"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4358a9e11b9a09cf52383b451b49a169e8d797b68aa02301ff586d70d9661ea3"
[[package]]
name = "either"
version = "1.5.3"
@ -685,9 +690,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "indexmap"
version = "1.3.2"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292"
checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe"
dependencies = [
"autocfg",
]
@ -953,15 +958,6 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "proc-macro2-impersonated"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d32df793782c132f437089d84b487d617a0baac886fa8519751dca07db9266e0"
dependencies = [
"unicode-xid",
]
[[package]]
name = "quote"
version = "1.0.6"
@ -971,15 +967,6 @@ dependencies = [
"proc-macro2",
]
[[package]]
name = "quote-impersonated"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e3e450e6f50c99055b77f01eb206d8accbb7a1d14c2c7be2b0a829286296dc9"
dependencies = [
"proc-macro2-impersonated",
]
[[package]]
name = "rand"
version = "0.7.3"
@ -1139,7 +1126,7 @@ checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"
[[package]]
name = "sailfish"
version = "0.0.1"
version = "0.0.2"
dependencies = [
"itoa",
"ryu",
@ -1253,17 +1240,6 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "syn-impersonated"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c11664eb1aded8a1be30656bedb3c2ee3d6b594842c90ec635cf7b855a5d8478"
dependencies = [
"proc-macro2-impersonated",
"quote-impersonated",
"unicode-xid",
]
[[package]]
name = "syntect"
version = "4.2.0"
@ -1382,18 +1358,18 @@ checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
[[package]]
name = "v_escape"
version = "0.7.4"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "660b101c07b5d0863deb9e7fb3138777e858d6d2a79f9e6049a27d1cc77c6da6"
checksum = "6cad47b72883380358c04f5771d29e3312df13375cb12a9c36ac469b1316e4c6"
dependencies = [
"v_escape_derive",
]
[[package]]
name = "v_escape_derive"
version = "0.5.6"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2ca2a14bc3fc5b64d188b087a7d3a927df87b152e941ccfbc66672e20c467ae"
checksum = "d3ca1bd1654394f99e5a7360c93fe36bfece483b166970e44fa712d10c49becd"
dependencies = [
"nom 4.2.3",
"proc-macro2",
@ -1403,19 +1379,19 @@ dependencies = [
[[package]]
name = "v_eval"
version = "0.5.3"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a419cdda656c514fbb974d5634994278be348867645cb65bf21a9b0676b9c2"
checksum = "0dd8b599d797eb038d0dde9a3860aacb6bbba3bffa4ac64f807c8673820cc9d9"
dependencies = [
"regex",
"syn-impersonated",
"syn",
]
[[package]]
name = "v_htmlescape"
version = "0.4.5"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e33e939c0d8cf047514fb6ba7d5aac78bc56677a6938b2ee67000b91f2e97e41"
checksum = "df14628045454a33708f240f554caf3f4d30699de40ec813af51f286f924cbd4"
dependencies = [
"cfg-if",
"v_escape",
@ -1568,9 +1544,9 @@ dependencies = [
[[package]]
name = "yarte"
version = "0.8.3"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "884cff3b02a11d026c493282e598a5c990b17fa22b91fb73aad2bfeee47f4f01"
checksum = "78bddb9840b1bbdd2617bfb72ab57f89630b84cd2c57c22b5ff2bc4c9fda07a9"
dependencies = [
"yarte_derive",
"yarte_helpers",
@ -1578,27 +1554,27 @@ dependencies = [
[[package]]
name = "yarte_codegen"
version = "0.8.3"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a64e8ba00f9d77cd05b665b3515251544c5b1f4885e7e3f7ffc54ea27f52eabc"
checksum = "9f28c1adc3182bac8062eee8f3cf3413dd4341644c218fc555e000bece67e3a7"
dependencies = [
"proc-macro2-impersonated",
"quote-impersonated",
"syn-impersonated",
"proc-macro2",
"quote",
"syn",
"yarte_helpers",
"yarte_hir",
]
[[package]]
name = "yarte_derive"
version = "0.8.3"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50f11ebd841875bd9b906017844640aaac1571a4a188b3f7577efd6c02616da1"
checksum = "9d751cb27f08da1436f33175e559da5a91f48e22ba6f0ea086f91a6b3ff10c61"
dependencies = [
"prettyprint",
"proc-macro2-impersonated",
"quote-impersonated",
"syn-impersonated",
"proc-macro2",
"quote",
"syn",
"tempfile",
"toolchain_find",
"yarte_codegen",
@ -1609,10 +1585,12 @@ dependencies = [
[[package]]
name = "yarte_helpers"
version = "0.8.3"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "771250e834a31e39a6e34e48e3fd9032542d211cb3f194f9a71b603fb841a793"
checksum = "dc1321a1916ff355aa8059a1c6031520adffd0688b4d0778ba5b42ea939bfb86"
dependencies = [
"dtoa",
"itoa",
"serde",
"toml",
"v_htmlescape",
@ -1620,14 +1598,14 @@ dependencies = [
[[package]]
name = "yarte_hir"
version = "0.8.3"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c86bad7da0c2ae56374390919fa1d7abaa067f6325a3e27865ae8598bfc24057"
checksum = "28860d9e257c16acc13d9686d098f0f8806752fc94389c2b0fd633aa8b2dbb46"
dependencies = [
"derive_more",
"proc-macro2-impersonated",
"quote-impersonated",
"syn-impersonated",
"proc-macro2",
"quote",
"syn",
"v_eval",
"v_htmlescape",
"yarte_helpers",
@ -1636,15 +1614,15 @@ dependencies = [
[[package]]
name = "yarte_parser"
version = "0.8.3"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f855c622d29c8a8af4f4b7a3f81e83ac0be6e6074977a017c3945db05fba311"
checksum = "82da989bca8b3496c64082cde17e47e49aad1f28b387c19f48762ac3e114e7b3"
dependencies = [
"annotate-snippets",
"derive_more",
"proc-macro2-impersonated",
"quote-impersonated",
"syn-impersonated",
"proc-macro2",
"quote",
"syn",
"unicode-xid",
"yarte_helpers",
]

View File

@ -10,7 +10,7 @@ horrorshow = "0.8.3"
markup = "0.4.1"
askama = "0.9.0"
criterion = "0.3.2"
yarte = "0.8.3"
yarte = { version = "0.9.8", features = ["fixed"] }
sailfish = { path = "../sailfish" }
sailfish-macros = { path = "../sailfish-macros" }
fomat-macros = "0.3.1"

View File

@ -1,6 +1,6 @@
use criterion::{criterion_group, criterion_main, Criterion};
use benches::{
askama_bench, fomat, horrorshow_bench, markup_bench, sailfish, std_write, yarte_bench
askama_bench, fomat, horrorshow_bench, markup_bench, sailfish, std_write, yarte_bench, yarte_fixed
};
fn big_table(c: &mut Criterion) {
@ -10,6 +10,7 @@ fn big_table(c: &mut Criterion) {
g.bench_function("Horrorshow", |b| horrorshow_bench::big_table(b, &100));
g.bench_function("Markup", |b| markup_bench::big_table(b, &100));
g.bench_function("Yarte", |b| yarte_bench::big_table(b, &100));
g.bench_function("Yarte Fixed", |b| yarte_fixed::big_table(b, &100));
g.bench_function("write", |b| std_write::big_table(b, &100));
g.bench_function("sailfish", |b| sailfish::big_table(b, &100));
g.finish();
@ -22,6 +23,7 @@ fn teams(c: &mut Criterion) {
g.bench_function("Horrorshow", |b| horrorshow_bench::teams(b, &0));
g.bench_function("Markup", |b| markup_bench::teams(b, &0));
g.bench_function("Yarte", |b| yarte_bench::teams(b));
g.bench_function("Yarte Fixed", |b| yarte_fixed::teams(b));
g.bench_function("write", |b| std_write::teams(b, &0));
g.bench_function("sailfish", |b| sailfish::teams(b));
g.finish();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

@ -5,3 +5,4 @@ pub mod markup_bench;
pub mod sailfish;
pub mod std_write;
pub mod yarte_bench;
pub mod yarte_fixed;

View File

@ -0,0 +1,74 @@
use yarte::TemplateFixed;
pub fn big_table(b: &mut criterion::Bencher<'_>, size: &usize) {
let mut table = Vec::with_capacity(*size);
for _ in 0..*size {
let mut inner = Vec::with_capacity(*size);
for i in 0..*size {
inner.push(i);
}
table.push(inner);
}
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);
}
buf
});
}
#[derive(TemplateFixed)]
#[template(path = "big-table.hbs")]
struct BigTable {
table: Vec<Vec<usize>>,
}
pub fn teams(b: &mut criterion::Bencher<'_>) {
let teams = Teams {
year: 2015,
teams: vec![
Team {
name: "Jiangsu".into(),
score: 43,
},
Team {
name: "Beijing".into(),
score: 27,
},
Team {
name: "Guangzhou".into(),
score: 22,
},
Team {
name: "Shandong".into(),
score: 12,
},
],
};
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);
}
buf
});
}
#[derive(TemplateFixed)]
#[template(path = "teams.hbs")]
struct Teams {
year: u16,
teams: Vec<Team>,
}
struct Team {
name: String,
score: u8,
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 45 KiB