Skip to content

Commit

Permalink
avoid being too slow when the len range is too wide in forced mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekleog committed Jan 28, 2023
1 parent 32257b2 commit fd6e10a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bolero-generator/src/driver/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ macro_rules! gen_from_bytes {
where
Gen: FnMut(&[u8]) -> Option<(usize, T)>,
{
const ABUSIVE_SIZE: usize = 64 * 1024;
const ABUSIVE_SIZE: usize = 1024;
const MIN_INCREASE: usize = 32;

match self.mode() {
DriverMode::Direct => {
let len = self.gen_usize(
Bound::Included(len.start()),
Bound::Included(&std::cmp::min(*len.end(), ABUSIVE_SIZE)),
)?;
let len = match (len.start(), len.end()) {
(s, e) if s == e => *s,
(s, e) => self.gen_usize(Bound::Included(s), Bound::Included(e))?,
};
let mut data = vec![0; len];
self.peek_bytes(0, &mut data)?;
match gen(&data) {
Expand Down

0 comments on commit fd6e10a

Please sign in to comment.