-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from ballsteve/dev
Version 1.0 Release
- Loading branch information
Showing
1,124 changed files
with
44,226 additions
and
8,887 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use std::rc::Rc; | ||
|
||
use criterion::{black_box, criterion_group, criterion_main, Criterion}; | ||
|
||
use xrust::item::Node; | ||
use xrust::qname::QualifiedName; | ||
use xrust::trees::smite::{Node as SmiteNode, RNode}; | ||
use xrust::value::Value; | ||
|
||
fn make_rnode(n: u64) -> RNode { | ||
let mut a = Rc::new(SmiteNode::new()); | ||
let mut b = a | ||
.new_element(QualifiedName::new(None, None, String::from("Test"))) | ||
.expect("unable to create element"); | ||
a.push(b.clone()).expect("unable to add node"); | ||
(1..n).for_each(|i| { | ||
let mut l1 = a | ||
.new_element(QualifiedName::new(None, None, String::from("Level-1"))) | ||
.expect("unable to create element"); | ||
b.push(l1.clone()).expect("unable to add node"); | ||
(1..n).for_each(|k| { | ||
let mut l2 = a | ||
.new_element(QualifiedName::new(None, None, String::from("Level-2"))) | ||
.expect("unable to create element"); | ||
l1.push(l2.clone()).expect("unable to add node"); | ||
l2.push( | ||
a.new_text(Rc::new(Value::from(format!("node {}-{}", i, k)))) | ||
.expect("unable to create text node"), | ||
) | ||
.expect("unable to add node"); | ||
}); | ||
}); | ||
a | ||
} | ||
|
||
fn rnode(c: &mut Criterion) { | ||
c.bench_function("rnode 100", |b| b.iter(|| make_rnode(black_box(1000)))); | ||
} | ||
|
||
criterion_group!(benches, rnode); | ||
criterion_main!(benches); |
Oops, something went wrong.