Skip to content

Commit

Permalink
optimize the logic, update to 0.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
fefit committed Mar 27, 2021
1 parent 97948e2 commit e2f4b9f
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 259 deletions.
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rphtml"
version = "0.5.2"
version = "0.5.3"
authors = ["jxz_211 <[email protected]>"]
edition = "2018"
license = "MIT"
Expand All @@ -23,11 +23,10 @@ crate-type = ["cdylib", "rlib"]

[dev-dependencies]
criterion = "0.3"
wasm-bindgen-test = "0.3.18"

[[bench]]
name = "benchmark"
harness = false

[profile.release]
debug = true
debug = false
38 changes: 16 additions & 22 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4957,30 +4957,24 @@ fn main() -> Result<(), Box<dyn Error>> {
<!--b296c95a3D9-->
"##;
let code: String = format!(
r##"
<ul>{}</ul>
"##,
String::from("<li></li><li>abcdefghijklmnopqrstuvwxyz&amp;abcdefghijklmnopqrstuvwxy</li>")
.repeat(3000 / 2)
);
let start_time = SystemTime::now();
let total = 200;
let doc = Doc::parse(
&code,
ParseOptions {
auto_fix_unexpected_endtag: true,
allow_self_closing: true,
auto_fix_unclosed_tag: true,
auto_fix_unescaped_lt: true,
..Default::default()
},
)?;
let total = 500;

for _ in 0..total {
let content = doc.render_text(&RenderOptions {
decode_entity: true,
..Default::default()
});
let doc = Doc::parse(
&code,
ParseOptions {
auto_fix_unexpected_endtag: true,
allow_self_closing: true,
auto_fix_unclosed_tag: true,
auto_fix_unescaped_lt: true,
..Default::default()
},
)?;
// let content = doc.render_text(&RenderOptions {
// decode_entity: true,
// ..Default::default()
// });
// println!("{:?}", content);
// println!("doc:{}", doc.render(&Default::default()));
}
Expand Down
Loading

0 comments on commit e2f4b9f

Please sign in to comment.