From bdd8126b938de11272f79bb7f512316740469ed7 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Fri, 27 Jan 2023 14:22:33 +0000 Subject: use cap-std --- openat/benches/count_processes.rs | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 openat/benches/count_processes.rs (limited to 'openat/benches/count_processes.rs') diff --git a/openat/benches/count_processes.rs b/openat/benches/count_processes.rs deleted file mode 100644 index aa9f856..0000000 --- a/openat/benches/count_processes.rs +++ /dev/null @@ -1,39 +0,0 @@ -#![feature(test)] - -extern crate openat; -extern crate test; - - -use std::fs::read_dir; -use std::str::from_utf8; -use std::os::unix::ffi::OsStrExt; -use test::Bencher; - -use openat::Dir; - - -#[bench] -fn procs_stdlib(b: &mut Bencher) { - b.iter(|| { - read_dir("/proc").unwrap().filter(|r| { - r.as_ref().ok() - .and_then(|e| from_utf8(e.file_name().as_bytes()).ok() - // pid is everything that can be parsed as a number - .and_then(|s| s.parse::().ok())) - .is_some() - }).count() - }); -} - -#[bench] -fn procs_openat(b: &mut Bencher) { - b.iter(|| { - Dir::open("/proc").unwrap().list_dir(".").unwrap().filter(|r| { - r.as_ref().ok() - .and_then(|e| from_utf8(e.file_name().as_bytes()).ok() - // pid is everything that can be parsed as a number - .and_then(|s| s.parse::().ok())) - .is_some() - }).count() - }); -} -- cgit v1.2.3-54-g00ecf