Created
February 24, 2020 02:33
-
-
Save dfyz/36ecbcdcbde052bd11b457ad6df9548e to your computer and use it in GitHub Desktop.
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
fn do_test(x: usize) { | |
let arr = vec![vec![0u8; 3]]; | |
let mut z = vec![0]; | |
for arr_ref in arr { | |
for y in 0..x { | |
for _ in 0..1 { | |
z.reserve_exact(x); | |
let iterator = std::iter::repeat(0).take(x); | |
let mut cnt = 0; | |
iterator.for_each(|_| { | |
z[0] = 0; | |
cnt += 1; | |
}); | |
let a = y * x; | |
let b = (y + 1) * x - 1; | |
let slice = &arr_ref[a..b]; | |
eprintln!("{} {} {} {}", a, b, arr_ref.len(), slice.len()); | |
eprintln!("{:?}", slice[1 << 24]); | |
} | |
} | |
} | |
} | |
fn main() { | |
do_test(1); | |
do_test(2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment