aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--benches/whirl_common.rs15
-rw-r--r--crates/whirl_common/Cargo.toml8
3 files changed, 24 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index f18a778..ee93e9b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,7 @@ Cargo.lock
/Whirl.toml
/.secrets
/log/
+/crates/**/target/
# DB Browser
/whirl.sqlite3-shm
diff --git a/benches/whirl_common.rs b/benches/whirl_common.rs
new file mode 100644
index 0000000..dd4a945
--- /dev/null
+++ b/benches/whirl_common.rs
@@ -0,0 +1,15 @@
+// Copyleft (ɔ) 2021-2021 The Whirlsplash Collective
+// SPDX-License-Identifier: GPL-3.0-only
+
+fn iai_benchmark_sort_vec_alphabetically() {
+ whirl_common::sort::vec_alphabetically(&mut vec!["a", "c", "d", "b"])
+}
+
+fn iai_benchmark_system_seconds_to_hrtime() -> String {
+ whirl_common::system::seconds_to_hrtime(1623058677)
+}
+
+iai::main!(
+ iai_benchmark_sort_vec_alphabetically,
+ iai_benchmark_system_seconds_to_hrtime
+);
diff --git a/crates/whirl_common/Cargo.toml b/crates/whirl_common/Cargo.toml
index 6d89283..03274e7 100644
--- a/crates/whirl_common/Cargo.toml
+++ b/crates/whirl_common/Cargo.toml
@@ -16,3 +16,11 @@ publish = false
[dependencies]
# Config
whirl_config = { path = "../whirl_config" }
+
+[dev-dependencies]
+iai = "0.1.1"
+
+[[bench]]
+name = "whirl_common"
+path = "../../benches/whirl_common.rs"
+harness = false