summaryrefslogtreecommitdiffstats
path: root/library/core/benches/num/flt2dec/strategy/dragon.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /library/core/benches/num/flt2dec/strategy/dragon.rs
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/core/benches/num/flt2dec/strategy/dragon.rs')
-rw-r--r--library/core/benches/num/flt2dec/strategy/dragon.rs76
1 files changed, 76 insertions, 0 deletions
diff --git a/library/core/benches/num/flt2dec/strategy/dragon.rs b/library/core/benches/num/flt2dec/strategy/dragon.rs
new file mode 100644
index 000000000..319b9773e
--- /dev/null
+++ b/library/core/benches/num/flt2dec/strategy/dragon.rs
@@ -0,0 +1,76 @@
+use super::super::*;
+use core::num::flt2dec::strategy::dragon::*;
+use std::mem::MaybeUninit;
+use test::Bencher;
+
+#[bench]
+fn bench_small_shortest(b: &mut Bencher) {
+ let decoded = decode_finite(3.141592f64);
+ let mut buf = [MaybeUninit::new(0); MAX_SIG_DIGITS];
+ b.iter(|| {
+ format_shortest(&decoded, &mut buf);
+ });
+}
+
+#[bench]
+fn bench_big_shortest(b: &mut Bencher) {
+ let decoded = decode_finite(f64::MAX);
+ let mut buf = [MaybeUninit::new(0); MAX_SIG_DIGITS];
+ b.iter(|| {
+ format_shortest(&decoded, &mut buf);
+ });
+}
+
+#[bench]
+fn bench_small_exact_3(b: &mut Bencher) {
+ let decoded = decode_finite(3.141592f64);
+ let mut buf = [MaybeUninit::new(0); 3];
+ b.iter(|| {
+ format_exact(&decoded, &mut buf, i16::MIN);
+ });
+}
+
+#[bench]
+fn bench_big_exact_3(b: &mut Bencher) {
+ let decoded = decode_finite(f64::MAX);
+ let mut buf = [MaybeUninit::new(0); 3];
+ b.iter(|| {
+ format_exact(&decoded, &mut buf, i16::MIN);
+ });
+}
+
+#[bench]
+fn bench_small_exact_12(b: &mut Bencher) {
+ let decoded = decode_finite(3.141592f64);
+ let mut buf = [MaybeUninit::new(0); 12];
+ b.iter(|| {
+ format_exact(&decoded, &mut buf, i16::MIN);
+ });
+}
+
+#[bench]
+fn bench_big_exact_12(b: &mut Bencher) {
+ let decoded = decode_finite(f64::MAX);
+ let mut buf = [MaybeUninit::new(0); 12];
+ b.iter(|| {
+ format_exact(&decoded, &mut buf, i16::MIN);
+ });
+}
+
+#[bench]
+fn bench_small_exact_inf(b: &mut Bencher) {
+ let decoded = decode_finite(3.141592f64);
+ let mut buf = [MaybeUninit::new(0); 1024];
+ b.iter(|| {
+ format_exact(&decoded, &mut buf, i16::MIN);
+ });
+}
+
+#[bench]
+fn bench_big_exact_inf(b: &mut Bencher) {
+ let decoded = decode_finite(f64::MAX);
+ let mut buf = [MaybeUninit::new(0); 1024];
+ b.iter(|| {
+ format_exact(&decoded, &mut buf, i16::MIN);
+ });
+}