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.

152 lines
4.6KB

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