benchkit/
lib.rs

1//! Lightweight benchmarking toolkit focused on practical performance analysis and report generation.
2#![ cfg_attr( doc, doc = include_str!( concat!( env!( "CARGO_MANIFEST_DIR" ), "/", "readme.md" ) ) ) ]
3#![ doc( html_logo_url = "https://raw.githubusercontent.com/Wandalen/wTools/master/asset/img/logo_v3_trans_square.png" ) ]
4#![ doc(
5  html_favicon_url = "https://raw.githubusercontent.com/Wandalen/wTools/alpha/asset/img/logo_v3_trans_square_icon_small_v2.ico"
6) ]
7#![ doc( html_root_url = "https://docs.rs/benchkit/latest/benchkit/" ) ]
8#![ allow( clippy::std_instead_of_core ) ]
9#![ allow( clippy::format_push_string ) ]
10#![ allow( clippy::must_use_candidate ) ]
11#![ allow( clippy::uninlined_format_args ) ]
12#![ allow( clippy::doc_markdown ) ]
13#![ allow( clippy::missing_errors_doc ) ]
14#![ allow( clippy::implicit_hasher ) ]
15#![ allow( clippy::cast_possible_truncation ) ]
16#![ allow( clippy::needless_pass_by_value ) ]
17#![ allow( clippy::redundant_closure_for_method_calls ) ]
18#![ allow( clippy::cast_sign_loss ) ]
19#![ allow( clippy::used_underscore_binding ) ]
20#![ allow( clippy::missing_panics_doc ) ]
21#![ allow( clippy::return_self_not_must_use ) ]
22#![ allow( clippy::useless_format ) ]
23#![ allow( clippy::if_not_else ) ]
24#![ allow( clippy::unnecessary_wraps ) ]
25#![ allow( clippy::cloned_instead_of_copied ) ]
26#![ allow( clippy::unnecessary_debug_formatting ) ]
27#![ allow( clippy::needless_borrows_for_generic_args ) ]
28#![ allow( clippy::inherent_to_string ) ]
29#![ allow( clippy::unnecessary_map_or ) ]
30#![ allow( clippy::unused_self ) ]
31#![ allow( clippy::too_many_lines ) ]
32#![ allow( clippy::needless_borrow ) ]
33#![ allow( clippy::single_char_add_str ) ]
34#![ allow( clippy::match_same_arms ) ]
35#![ allow( clippy::empty_line_after_outer_attr ) ]
36#![ allow( clippy::similar_names ) ]
37#![ allow( unused_imports ) ]
38
39#[ cfg( feature = "enabled" ) ]
40fn check_directory_recommendations()
41{
42  #[ cfg( debug_assertions ) ]
43  if let Ok( current_dir ) = std::env::current_dir()
44  {
45  if let Some( dir_name ) = current_dir.file_name().and_then( | n | n.to_str() )
46  {
47   if dir_name == "benches"
48   {
49  eprintln!( "✅ benchkit: Running in REQUIRED benches/ directory - CORRECT!" );
50  eprintln!( "   Remember to update benches/readme.md with your benchmark results" );
51  eprintln!( "   Use MarkdownUpdater to automatically maintain comprehensive reports" );
52  eprintln!( "   See: https://docs.rs/benchkit#mandatory-benches-directory" );
53 }
54   else if dir_name == "tests" || dir_name == "examples" || dir_name == "src"
55   {
56  eprintln!( "❌ benchkit ERROR: Benchmarks MUST be in benches/ directory!" );
57  eprintln!( "   Current location: {}/", dir_name );
58  eprintln!( "   REQUIRED: Move ALL benchmark files to benches/ directory" );
59  eprintln!( "   Benchmarks are NOT tests - they belong in benches/ ONLY" );
60  eprintln!( "   See: https://docs.rs/benchkit#mandatory-benches-directory" );
61 }
62 }
63 }
64}
65
66#[ cfg( feature = "enabled" ) ]
67pub mod measurement;
68
69#[ cfg( feature = "enabled" ) ]
70pub mod analysis;
71
72#[ cfg( feature = "enabled" ) ]
73pub mod suite;
74
75#[ cfg( feature = "markdown_reports" ) ]
76pub mod reporting;
77
78#[ cfg( feature = "markdown_reports" ) ]
79pub mod update_chain;
80
81#[ cfg( feature = "markdown_reports" ) ]
82pub mod templates;
83
84#[ cfg( feature = "enabled" ) ]
85pub mod validation;
86
87#[ cfg( feature = "data_generators" ) ]
88pub mod generators;
89
90#[ cfg( feature = "enabled" ) ]
91pub mod scaling;
92
93#[ cfg( feature = "enabled" ) ]
94pub mod profiling;
95
96#[ cfg( feature = "markdown_reports" ) ]
97pub mod documentation;
98
99#[ cfg( feature = "enabled" ) ]
100pub mod comparison;
101
102#[ cfg( feature = "diff_analysis" ) ]
103pub mod diff;
104
105#[ cfg( feature = "visualization" ) ]
106pub mod plotting;
107
108#[ cfg( feature = "statistical_analysis" ) ]
109pub mod statistical;
110
111#[ cfg( feature = "enabled" ) ]
112pub mod data_generation;
113
114#[ cfg( feature = "enabled" ) ]
115pub mod throughput;
116
117#[ cfg( feature = "enabled" ) ]
118pub mod memory_tracking;
119
120#[ cfg( feature = "enabled" ) ]
121pub mod parser_analysis;
122
123#[ cfg( feature = "enabled" ) ]
124pub mod parser_data_generation;
125
126/// Prelude module for convenient imports
127#[ cfg( feature = "enabled" ) ]
128pub mod prelude
129{
130  pub use crate::measurement::*;
131  pub use crate::analysis::*;
132  pub use crate::suite::*;
133  pub use std::time::{ Duration, Instant };
134
135  #[ cfg( feature = "markdown_reports" ) ]
136  pub use crate::reporting::*;
137
138  #[ cfg( feature = "markdown_reports" ) ]
139  pub use crate::update_chain::*;
140
141  #[ cfg( feature = "markdown_reports" ) ]
142  pub use crate::templates::*;
143
144  pub use crate::validation::*;
145
146  #[ cfg( feature = "data_generators" ) ]
147  pub use crate::generators::*;
148  
149  pub use crate::scaling::*;
150  pub use crate::profiling::*;
151  pub use crate::comparison::*;
152  
153  #[ cfg( feature = "markdown_reports" ) ]
154  pub use crate::documentation::*;
155  
156  #[ cfg( feature = "diff_analysis" ) ]
157  pub use crate::diff::*;
158  
159  #[ cfg( feature = "visualization" ) ]
160  pub use crate::plotting::*;
161  
162  #[ cfg( feature = "statistical_analysis" ) ]
163  pub use crate::statistical::*;
164  
165  pub use crate::data_generation::*;
166  pub use crate::throughput::*;
167  pub use crate::memory_tracking::*;
168  pub use crate::parser_analysis::*;
169  pub use crate::parser_data_generation::*;
170}