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