Last active
June 1, 2020 15:17
-
-
Save fecetrulo/f41ee9f3b90ae9d9d6dac1f552fee155 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
use zmq; | |
static BYTES: usize = 1_000_000; | |
static META: &str = "meta"; | |
fn main() { | |
let qtd = 2000; | |
let info: Vec<u8> = vec![0; BYTES]; | |
let meta = META; | |
let mut result = Vec::new(); | |
(0..qtd).for_each(|_| { | |
let meta = zmq::Message::from(meta); | |
let info = zmq::Message::from(&info); | |
result.push((meta.to_vec(), info.to_vec())) | |
}); | |
let mut count = 0; | |
result.into_iter().for_each(|(meta, info)| { | |
if std::str::from_utf8(&meta).unwrap() == META | |
&& info.len() == BYTES | |
{ | |
count += 1; | |
} | |
}); | |
println!("count {}", count); | |
loop {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment