Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fp-succinct-trees-1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Mehren
fp-succinct-trees-1
Commits
de7a47c1
Verified
Commit
de7a47c1
authored
7 years ago
by
David Mehren
Browse files
Options
Downloads
Patches
Plain Diff
Update benchmarks to use big trees
parent
1658d633
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
benches/treebench.rs
+29
-10
29 additions, 10 deletions
benches/treebench.rs
with
29 additions
and
10 deletions
benches/treebench.rs
+
29
−
10
View file @
de7a47c1
#[macro_use]
extern
crate
criterion
;
extern
crate
bv
;
extern
crate
fp_succinct_trees_1
;
extern
crate
id_tree
;
use
criterion
::
Criterion
;
use
criterion
::
Fun
;
use
fp_succinct_trees_1
::
bp_tree
::
BPTree
;
use
fp_succinct_trees_1
::
common
::
succinct_tree
::
SuccinctTree
;
use
fp_succinct_trees_1
::
trees
::
bp_tree
::
BPTree
;
use
fp_succinct_trees_1
::
trees
::
louds_tree
::
LOUDSTree
;
use
fp_succinct_trees_1
::
louds_tree
::
LOUDSTree
;
use
id_tree
::
InsertBehavior
::
*
;
use
id_tree
::
Node
;
use
id_tree
::
NodeId
;
...
...
@@ -34,6 +35,22 @@ fn create_bench_tree() -> Tree<i32> {
tree
}
fn
create_bench_louds
()
->
LOUDSTree
<
i32
>
{
LOUDSTree
::
from_file
(
"testdata/loudshuge.benchdata"
.to_string
())
.unwrap
()
}
fn
create_bench_bp
()
->
BPTree
<
i32
>
{
BPTree
::
from_file
(
"testdata/bphuge.benchdata"
.to_string
())
.unwrap
()
}
fn
compare_load_huge_tree
(
c
:
&
mut
Criterion
)
{
let
louds
=
Fun
::
new
(
"LOUDS from file"
,
|
b
,
i
|
b
.iter
(||
create_bench_louds
()));
let
bp
=
Fun
::
new
(
"BP from file"
,
|
b
,
i
|
{
b
.iter
(||
create_bench_bp
());
});
c
.bench_functions
(
"Load huge trees"
,
vec!
[
louds
,
bp
],
0
);
}
fn
create_bench_idtree
(
c
:
&
mut
Criterion
)
{
let
tree
=
create_bench_tree
();
c
.bench_function
(
"Create bench tree"
,
|
b
|
b
.iter
(||
create_bench_tree
()));
...
...
@@ -50,32 +67,32 @@ fn compare_from_id_tree(c: &mut Criterion) {
}
fn
compare_is_leaf
(
c
:
&
mut
Criterion
)
{
let
louds
=
LOUDSTree
::
from_id_tree
(
create_bench_tree
())
.unwrap
();
let
bp
=
BPTree
::
from_id_tree
(
create_bench_tree
())
.unwra
p
();
let
louds
=
create_bench_louds
();
let
bp
=
create_bench_b
p
();
let
louds_fun
=
Fun
::
new
(
"LOUDS"
,
move
|
b
,
_
|
b
.iter
(||
louds
.is_leaf
(
1
)));
let
bp_fun
=
Fun
::
new
(
"BP"
,
move
|
b
,
_
|
b
.iter
(||
bp
.is_leaf
(
1
)));
c
.bench_functions
(
"Compare is_leaf()"
,
vec!
[
louds_fun
,
bp_fun
],
0
);
}
fn
compare_parent
(
c
:
&
mut
Criterion
)
{
let
louds
=
LOUDSTree
::
from_id_tree
(
create_bench_tree
())
.unwrap
();
let
bp
=
BPTree
::
from_id_tree
(
create_bench_tree
())
.unwra
p
();
let
louds
=
create_bench_louds
();
let
bp
=
create_bench_b
p
();
let
louds_fun
=
Fun
::
new
(
"LOUDS"
,
move
|
b
,
_
|
b
.iter
(||
louds
.parent
(
1
)));
let
bp_fun
=
Fun
::
new
(
"BP"
,
move
|
b
,
_
|
b
.iter
(||
bp
.parent
(
1
)));
c
.bench_functions
(
"Compare parent()"
,
vec!
[
louds_fun
,
bp_fun
],
0
);
}
fn
compare_first_child
(
c
:
&
mut
Criterion
)
{
let
louds
=
LOUDSTree
::
from_id_tree
(
create_bench_tree
())
.unwrap
();
let
bp
=
BPTree
::
from_id_tree
(
create_bench_tree
())
.unwra
p
();
let
louds
=
create_bench_louds
();
let
bp
=
create_bench_b
p
();
let
louds_fun
=
Fun
::
new
(
"LOUDS"
,
move
|
b
,
_
|
b
.iter
(||
louds
.first_child
(
1
)));
let
bp_fun
=
Fun
::
new
(
"BP"
,
move
|
b
,
_
|
b
.iter
(||
bp
.first_child
(
1
)));
c
.bench_functions
(
"Compare first_child()"
,
vec!
[
louds_fun
,
bp_fun
],
0
);
}
fn
compare_next_sibling
(
c
:
&
mut
Criterion
)
{
let
louds
=
LOUDSTree
::
from_id_tree
(
create_bench_tree
())
.unwrap
();
let
bp
=
BPTree
::
from_id_tree
(
create_bench_tree
())
.unwra
p
();
let
louds
=
create_bench_louds
();
let
bp
=
create_bench_b
p
();
let
louds_fun
=
Fun
::
new
(
"LOUDS"
,
move
|
b
,
_
|
b
.iter
(||
louds
.next_sibling
(
1
)));
let
bp_fun
=
Fun
::
new
(
"BP"
,
move
|
b
,
_
|
b
.iter
(||
bp
.next_sibling
(
1
)));
c
.bench_functions
(
"Compare next_sibling()"
,
vec!
[
louds_fun
,
bp_fun
],
0
);
...
...
@@ -84,6 +101,8 @@ fn compare_next_sibling(c: &mut Criterion) {
criterion_group!
(
benches
,
create_bench_idtree
,
compare_load_huge_tree
,
compare_parent
,
compare_from_id_tree
,
compare_is_leaf
,
compare_first_child
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment