Instantly share code, notes, and snippets.

Embed
What would you like to do?
Code shared from the Rust Playground
use criterion::black_box;
fn using_flat_map(big: i32) {
for (a, b) in (1..big).flat_map(|a| (0..a).map(move |b| (a, b))) {
black_box((a, b));
}
}
fn using_for_loops(big: i32) {
for a in 1..big {
for b in 0..a {
black_box((a, b));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment