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.

load.rs 4.6KB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. //! Benchmarking loading/markdown rendering of generated sites of various sizes
  2. #![feature(test)]
  3. extern crate test;
  4. extern crate site;
  5. use std::env;
  6. use site::Site;
  7. #[bench]
  8. fn bench_loading_small_blog(b: &mut test::Bencher) {
  9. let mut path = env::current_dir().unwrap().to_path_buf();
  10. path.push("benches");
  11. path.push("small-blog");
  12. let mut site = Site::new(&path, "config.toml").unwrap();
  13. b.iter(|| site.load().unwrap());
  14. }
  15. #[bench]
  16. fn bench_loading_small_blog_with_syntax_highlighting(b: &mut test::Bencher) {
  17. let mut path = env::current_dir().unwrap().to_path_buf();
  18. path.push("benches");
  19. path.push("small-blog");
  20. let mut site = Site::new(&path, "config.toml").unwrap();
  21. site.config.highlight_code = true;
  22. b.iter(|| site.load().unwrap());
  23. }
  24. //#[bench]
  25. //fn bench_loading_medium_blog(b: &mut test::Bencher) {
  26. // let mut path = env::current_dir().unwrap().to_path_buf();
  27. // path.push("benches");
  28. // path.push("medium-blog");
  29. // let mut site = Site::new(&path, "config.toml").unwrap();
  30. //
  31. // b.iter(|| site.load().unwrap());
  32. //}
  33. //
  34. //#[bench]
  35. //fn bench_loading_medium_blog_with_syntax_highlighting(b: &mut test::Bencher) {
  36. // let mut path = env::current_dir().unwrap().to_path_buf();
  37. // path.push("benches");
  38. // path.push("medium-blog");
  39. // let mut site = Site::new(&path, "config.toml").unwrap();
  40. // site.config.highlight_code = true;
  41. //
  42. // b.iter(|| site.load().unwrap());
  43. //}
  44. //
  45. //#[bench]
  46. //fn bench_loading_big_blog(b: &mut test::Bencher) {
  47. // let mut path = env::current_dir().unwrap().to_path_buf();
  48. // path.push("benches");
  49. // path.push("big-blog");
  50. // let mut site = Site::new(&path, "config.toml").unwrap();
  51. //
  52. // b.iter(|| site.load().unwrap());
  53. //}
  54. //
  55. //#[bench]
  56. //fn bench_loading_big_blog_with_syntax_highlighting(b: &mut test::Bencher) {
  57. // let mut path = env::current_dir().unwrap().to_path_buf();
  58. // path.push("benches");
  59. // path.push("big-blog");
  60. // let mut site = Site::new(&path, "config.toml").unwrap();
  61. // site.config.highlight_code = true;
  62. //
  63. // b.iter(|| site.load().unwrap());
  64. //}
  65. //#[bench]
  66. //fn bench_loading_huge_blog(b: &mut test::Bencher) {
  67. // let mut path = env::current_dir().unwrap().to_path_buf();
  68. // path.push("benches");
  69. // path.push("huge-blog");
  70. // let mut site = Site::new(&path, "config.toml").unwrap();
  71. //
  72. // b.iter(|| site.load().unwrap());
  73. //}
  74. //
  75. //#[bench]
  76. //fn bench_loading_huge_blog_with_syntax_highlighting(b: &mut test::Bencher) {
  77. // let mut path = env::current_dir().unwrap().to_path_buf();
  78. // path.push("benches");
  79. // path.push("huge-blog");
  80. // let mut site = Site::new(&path, "config.toml").unwrap();
  81. // site.config.highlight_code = true;
  82. //
  83. // b.iter(|| site.load().unwrap());
  84. //}
  85. #[bench]
  86. fn bench_loading_small_kb(b: &mut test::Bencher) {
  87. let mut path = env::current_dir().unwrap().to_path_buf();
  88. path.push("benches");
  89. path.push("small-kb");
  90. let mut site = Site::new(&path, "config.toml").unwrap();
  91. b.iter(|| site.load().unwrap());
  92. }
  93. #[bench]
  94. fn bench_loading_small_kb_with_syntax_highlighting(b: &mut test::Bencher) {
  95. let mut path = env::current_dir().unwrap().to_path_buf();
  96. path.push("benches");
  97. path.push("small-kb");
  98. let mut site = Site::new(&path, "config.toml").unwrap();
  99. site.config.highlight_code = true;
  100. b.iter(|| site.load().unwrap());
  101. }
  102. //#[bench]
  103. //fn bench_loading_medium_kb(b: &mut test::Bencher) {
  104. // let mut path = env::current_dir().unwrap().to_path_buf();
  105. // path.push("benches");
  106. // path.push("medium-kb");
  107. // let mut site = Site::new(&path, "config.toml").unwrap();
  108. //
  109. // b.iter(|| site.load().unwrap());
  110. //}
  111. //
  112. //#[bench]
  113. //fn bench_loading_medium_kb_with_syntax_highlighting(b: &mut test::Bencher) {
  114. // let mut path = env::current_dir().unwrap().to_path_buf();
  115. // path.push("benches");
  116. // path.push("medium-kb");
  117. // let mut site = Site::new(&path, "config.toml").unwrap();
  118. // site.config.highlight_code = Some(true);
  119. //
  120. // b.iter(|| site.load().unwrap());
  121. //}
  122. //#[bench]
  123. //fn bench_loading_huge_kb(b: &mut test::Bencher) {
  124. // let mut path = env::current_dir().unwrap().to_path_buf();
  125. // path.push("benches");
  126. // path.push("huge-kb");
  127. // let mut site = Site::new(&path, "config.toml").unwrap();
  128. //
  129. // b.iter(|| site.load().unwrap());
  130. //}
  131. //
  132. //#[bench]
  133. //fn bench_loading_huge_kb_with_syntax_highlighting(b: &mut test::Bencher) {
  134. // let mut path = env::current_dir().unwrap().to_path_buf();
  135. // path.push("benches");
  136. // path.push("huge-kb");
  137. // let mut site = Site::new(&path, "config.toml").unwrap();
  138. // site.config.highlight_code = Some(true);
  139. //
  140. // b.iter(|| site.load().unwrap());
  141. //}