Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. $ # Generate 8 MB of random data
  2. $ head -c 8M < /dev/urandom > data.txt
  3. $ # Flush and clear the cache so we get the data from disk
  4. $ sync && echo 3 | sudo tee /proc/sys/vm/drop_caches && cargo script posix_fadvise_test.rs
  5. 3
  6. Compiling posix_fadvise_test v0.1.0 (file:///home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286)
  7. Advised result: HashResult { hash: [173, 168, 157, 204, 185, 126, 165, 177, 195, 111, 94, 179, 252, 59, 25, 169], time: Duration { secs: 0, nanos: 10050785 } }
  8. $ # Comment out the call to advise_willneed, save, flush again and re-run
  9. $ sync && echo 3 | sudo tee /proc/sys/vm/drop_caches && cargo script posix_fadvise_test.rs
  10. 3
  11. Compiling posix_fadvise_test v0.1.0 (file:///home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286)
  12. /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:40:1: 53:2 warning: function is never used: `advise_willneed`, #[warn(dead_code)] on by default
  13. /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:40 fn advise_willneed(file: &File) {
  14. /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:41 let len = file.metadata().unwrap().len();
  15. /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:42
  16. /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:43 unsafe {
  17. /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:44 assert_eq!(
  18. /home/austin/.cargo/script-cache/file-posix_fadvise_test-8d6a7e80a3131286/posix_fadvise_test.rs:45 libc::posix_fadvise(
  19. ...
  20. Advised result: HashResult { hash: [173, 168, 157, 204, 185, 126, 165, 177, 195, 111, 94, 179, 252, 59, 25, 169], time: Duration { secs: 0, nanos: 33213398 } }
  21. $ # Significantly slower!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement