-
-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added Limit<N> and NoLimit to the configuration * Added a limit check to Decoder and DecoderImpl * Added test cases, added a helper function specialized for containers * Added a test to see if inlining makes the limit config faster, added inlining to the decoder
- Loading branch information
1 parent
882e227
commit 240558d
Showing
10 changed files
with
287 additions
and
15 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use criterion::{black_box, criterion_group, criterion_main, Criterion}; | ||
|
||
use bincode::config::Configuration; | ||
|
||
fn inline_decoder_claim_bytes_read(c: &mut Criterion) { | ||
let config = Configuration::standard().with_limit::<100000>(); | ||
let slice = bincode::encode_to_vec(vec![String::from("Hello world"); 1000], config).unwrap(); | ||
|
||
c.bench_function("inline_decoder_claim_bytes_read", |b| { | ||
b.iter(|| { | ||
let _: Vec<String> = | ||
black_box(bincode::decode_from_slice(black_box(&slice), config).unwrap()); | ||
}) | ||
}); | ||
} | ||
|
||
criterion_group!(benches, inline_decoder_claim_bytes_read); | ||
criterion_main!(benches); |
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 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
Oops, something went wrong.