Skip to content

Commit a58dbfd

Browse files
committed
Remove non-FD benchmarks; they'll never change so shouldn't be a part of this
1 parent 66a3172 commit a58dbfd

File tree

1 file changed

+11
-27
lines changed

1 file changed

+11
-27
lines changed

benchmark/benchmarks.jl

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,17 @@ using BenchmarkTools, Statistics
2020
const SUITE = BenchmarkGroup()
2121
const N = parse(Int, get(ENV, "BENCH_NUM_ITERS", "1000"))
2222

23-
decimal_precision = 2
24-
25-
# Express that data through the various types. Round it for integers.
26-
fd_FixedPointDecimal_types = [
27-
FixedPointDecimals.FixedDecimal{Int32, decimal_precision},
28-
FixedPointDecimals.FixedDecimal{Int64, decimal_precision},
29-
FixedPointDecimals.FixedDecimal{Int128, decimal_precision},
23+
benchtypes = [
24+
FixedPointDecimals.FixedDecimal{Int32, 2},
25+
FixedPointDecimals.FixedDecimal{Int64, 2},
26+
FixedPointDecimals.FixedDecimal{Int128, 2},
3027
]
31-
inttypes = [Int32,Int64,Int128]
32-
floattypes = [Float32,Float64]
33-
#bigtypes = [BigInt, BigFloat]
34-
35-
alltypes = (inttypes..., floattypes..., fd_FixedPointDecimal_types...,)
3628

3729
identity1(a,_) = a
3830
allops = (*, /, +, ÷, identity1)
3931

40-
# Category for the results output CSV
41-
category(::Type{<:Union{inttypes...}}) = "Int"
42-
category(::Type{<:Union{floattypes...}}) = "Float"
43-
#category(::Type{<:Union{bigtypes...}}) = "Big"
44-
category(::Type{<:FixedPointDecimals.FixedDecimal}) = "FixedDecimal"
45-
type(T::Type) = "$T"
46-
type(T::Type{<:Union{Int32, Int64}}) = " $T"
47-
type(T::Type{Int128}) = " $T"
48-
type(::Type{FixedPointDecimals.FixedDecimal{T,f}}) where {T,f} = "FD{$T,$f}"
49-
type(::Type{FixedPointDecimals.FixedDecimal{T,f}}) where {T<:Union{Int32,Int64},f} = "FD{ $T,$f}"
32+
prettytype(::Type{FixedPointDecimals.FixedDecimal{T,f}}) where {T,f} = "FD{$T,$f}"
33+
prettytype(::Type{FixedPointDecimals.FixedDecimal{T,f}}) where {T<:Union{Int32,Int64},f} = "FD{ $T,$f}"
5034
opname(f) = string(Symbol(f))
5135
opname(f::typeof(identity1)) = "identity"
5236

@@ -79,15 +63,15 @@ end
7963
# Define the benchmark structure
8064
for op in allops
8165
SUITE[opname(op)] = BenchmarkGroup()
82-
for T in alltypes
83-
SUITE[opname(op)][type(T)] = BenchmarkGroup(["base", "bench"])
66+
for T in benchtypes
67+
SUITE[opname(op)][prettytype(T)] = BenchmarkGroup(["base", "bench"])
8468
end
8569
end
8670

8771
for op in allops
8872
println()
8973
println("$op")
90-
for T in alltypes
74+
for T in benchtypes
9175
print("$T ")
9276

9377
initial_value = zero(T)
@@ -99,8 +83,8 @@ for op in allops
9983

10084
# Run the benchmark
10185
outbase = Ref(initial_value)
102-
SUITE[opname(op)][type(T)]["base"] = @benchmarkable $fbase($outbase) evals=1 setup=($outbase[]=$initial_value)
86+
SUITE[opname(op)][prettytype(T)]["base"] = @benchmarkable $fbase($outbase) evals=1 setup=($outbase[]=$initial_value)
10387
outbench = Ref(initial_value)
104-
SUITE[opname(op)][type(T)]["bench"] = @benchmarkable $fbench($outbench) evals=1 setup=($outbench[]=$initial_value)
88+
SUITE[opname(op)][prettytype(T)]["bench"] = @benchmarkable $fbench($outbench) evals=1 setup=($outbench[]=$initial_value)
10589
end
10690
end

0 commit comments

Comments
 (0)