File: mod.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie, trixie-backports, trixie-proposed-updates
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (57 lines) | stat: -rw-r--r-- 1,291 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use test::{Bencher, black_box};

#[bench]
fn bench_0(b: &mut Bencher) {
    b.iter(|| black_box("0.0").parse::<f64>());
}

#[bench]
fn bench_42(b: &mut Bencher) {
    b.iter(|| black_box("42").parse::<f64>());
}

#[bench]
fn bench_huge_int(b: &mut Bencher) {
    // 2^128 - 1
    b.iter(|| black_box("170141183460469231731687303715884105727").parse::<f64>());
}

#[bench]
fn bench_short_decimal(b: &mut Bencher) {
    b.iter(|| black_box("1234.5678").parse::<f64>());
}

#[bench]
fn bench_pi_long(b: &mut Bencher) {
    b.iter(|| black_box("3.14159265358979323846264338327950288").parse::<f64>());
}

#[bench]
fn bench_pi_short(b: &mut Bencher) {
    b.iter(|| black_box("3.141592653589793").parse::<f64>())
}

#[bench]
fn bench_1e150(b: &mut Bencher) {
    b.iter(|| black_box("1e150").parse::<f64>());
}

#[bench]
fn bench_long_decimal_and_exp(b: &mut Bencher) {
    b.iter(|| black_box("727501488517303786137132964064381141071e-123").parse::<f64>());
}

#[bench]
fn bench_min_subnormal(b: &mut Bencher) {
    b.iter(|| black_box("5e-324").parse::<f64>());
}

#[bench]
fn bench_min_normal(b: &mut Bencher) {
    b.iter(|| black_box("2.2250738585072014e-308").parse::<f64>());
}

#[bench]
fn bench_max(b: &mut Bencher) {
    b.iter(|| black_box("1.7976931348623157e308").parse::<f64>());
}