Improve rendering performance

pull/1/head
trivernis 5 years ago
parent 9e1d13bce5
commit 03ebed6277

2
Cargo.lock generated

@ -444,7 +444,7 @@ dependencies = [
[[package]] [[package]]
name = "snekdown" name = "snekdown"
version = "0.2.2" version = "0.2.3"
dependencies = [ dependencies = [
"crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "htmlescape 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",

@ -1,6 +1,6 @@
[package] [package]
name = "snekdown" name = "snekdown"
version = "0.2.2" version = "0.2.3"
authors = ["trivernis <trivernis@protonmail.com>"] authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018" edition = "2018"
license-file = "LICENSE" license-file = "LICENSE"

@ -97,9 +97,8 @@ impl ToHtml for Section {
fn to_html(&self) -> String { fn to_html(&self) -> String {
let inner = self let inner = self
.elements .elements
.par_iter() .iter()
.map(|e| e.to_html()) .fold("".to_string(), |a, b| format!("{}{}", a, b.to_html()));
.reduce(|| "".to_string(), |a, b| format!("{}{}", a, b));
format!("<section>{}{}</section>", self.header.to_html(), inner) format!("<section>{}{}</section>", self.header.to_html(), inner)
} }
} }

Loading…
Cancel
Save