Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
rust-rocksdb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangzongwu
rust-rocksdb
Commits
af7d782a
Commit
af7d782a
authored
Jul 12, 2015
by
Tyler Neely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up after benchmarking tests. Enforce ordering on benchmarks.
parent
14dc3d00
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
main.rs
src/main.rs
+10
-7
No files found.
src/main.rs
View file @
af7d782a
...
...
@@ -91,9 +91,7 @@ mod tests {
use
rocksdb
::{
RocksDBOptions
,
RocksDB
,
MergeOperands
,
new_bloom_filter
,
Writable
};
use
rocksdb
::
RocksDBCompactionStyle
::
RocksDBUniversalCompaction
;
fn
tuned_for_somebody_elses_disk
()
->
RocksDB
{
let
path
=
"_rust_rocksdb_optimizetest"
;
let
opts
=
RocksDBOptions
::
new
();
fn
tuned_for_somebody_elses_disk
(
path
:
&
str
,
opts
:
RocksDBOptions
)
->
RocksDB
{
opts
.create_if_missing
(
true
);
opts
.set_block_size
(
524288
);
opts
.set_max_open_files
(
10000
);
...
...
@@ -121,10 +119,12 @@ mod tests {
}
#[bench]
fn
writes
(
b
:
&
mut
Bencher
)
{
fn
a_
writes
(
b
:
&
mut
Bencher
)
{
// dirty hack due to parallel tests causing contention.
sleep_ms
(
1000
);
let
db
=
tuned_for_somebody_elses_disk
();
let
path
=
"_rust_rocksdb_optimizetest"
;
let
opts
=
RocksDBOptions
::
new
();
let
db
=
tuned_for_somebody_elses_disk
(
path
,
opts
);
let
mut
i
=
0
as
u64
;
b
.iter
(||
{
db
.put
(
i
.to_string
()
.as_bytes
(),
b
"v1111"
);
...
...
@@ -134,8 +134,10 @@ mod tests {
}
#[bench]
fn
reads
(
b
:
&
mut
Bencher
)
{
let
db
=
tuned_for_somebody_elses_disk
();
fn
b_reads
(
b
:
&
mut
Bencher
)
{
let
path
=
"_rust_rocksdb_optimizetest"
;
let
opts
=
RocksDBOptions
::
new
();
let
db
=
tuned_for_somebody_elses_disk
(
path
,
opts
);
let
mut
i
=
0
as
u64
;
b
.iter
(||
{
db
.get
(
i
.to_string
()
.as_bytes
())
.on_error
(
|
e
|
{
...
...
@@ -145,5 +147,6 @@ mod tests {
i
+=
1
;
});
db
.close
();
RocksDB
::
destroy
(
opts
,
path
)
.is_ok
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment