Skip to content

Instantly share code, notes, and snippets.

@fecetrulo
Last active June 1, 2020 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fecetrulo/f41ee9f3b90ae9d9d6dac1f552fee155 to your computer and use it in GitHub Desktop.
Save fecetrulo/f41ee9f3b90ae9d9d6dac1f552fee155 to your computer and use it in GitHub Desktop.
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