You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

site.rs 987B

12345678910111213141516171819202122232425262728293031323334353637
  1. #![feature(test)]
  2. extern crate test;
  3. extern crate site;
  4. extern crate tempdir;
  5. use std::env;
  6. use tempdir::TempDir;
  7. use site::Site;
  8. fn setup_site(name: &str) -> Site {
  9. let mut path = env::current_dir().unwrap().to_path_buf();
  10. path.push("benches");
  11. path.push(name);
  12. let mut site = Site::new(&path, "config.toml").unwrap();
  13. site.load().unwrap();
  14. site
  15. }
  16. #[bench]
  17. fn bench_render_aliases(b: &mut test::Bencher) {
  18. let mut site = setup_site("huge-blog");
  19. let tmp_dir = TempDir::new("benches").expect("create temp dir");
  20. let public = &tmp_dir.path().join("public");
  21. site.set_output_path(&public);
  22. b.iter(|| site.render_aliases().unwrap());
  23. }
  24. #[bench]
  25. fn bench_render_sitemap(b: &mut test::Bencher) {
  26. let mut site = setup_site("huge-blog");
  27. let tmp_dir = TempDir::new("benches").expect("create temp dir");
  28. let public = &tmp_dir.path().join("public");
  29. site.set_output_path(&public);
  30. b.iter(|| site.render_sitemap().unwrap());
  31. }