-
Notifications
You must be signed in to change notification settings - Fork 0
/
CpsBenchmark.fs
124 lines (95 loc) · 3.59 KB
/
CpsBenchmark.fs
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
module CpsBenchmark
open BenchmarkDotNet.Attributes
open BenchmarkDotNet.Configs
open BenchmarkDotNet.Exporters
open BenchmarkDotNet.Exporters.Csv
open CpsDemo
open BenchmarkDotNet.Attributes.Jobs
type CpsConfig() as this =
inherit ManualConfig()
do
this.Add(CsvMeasurementsExporter.Default)
this.Add(RPlotExporter.Default)
[<
MemoryDiagnoser;
Config(typeof<CpsConfig>);
RPlotExporter;
// ShortRunJob
>]
type CpsPerformanceTests() =
let mutable allTheWords = []
[<GlobalSetup>]
member __.Setup() =
allTheWords <- mgetAllTheWordsAsList @"\Les Misérables.txt"
[<Benchmark>]
member __.Early() =
allTheWords |> replaceFirstItem "MISÉRABLES" "PERSONNES-CONTENUES"
[<Benchmark>]
member __.EarlyCPS() =
allTheWords |> replaceFirstItemCPS "MISÉRABLES" "PERSONNES-CONTENUES"
// [<Benchmark>]
member __.EarlyAvm1() =
allTheWords |> replaceFirstItemAvm1 "MISÉRABLES" "PERSONNES-CONTENUES"
// [<Benchmark>]
member __.EarlyAvm2() =
allTheWords |> replaceFirstItemAvm2 "MISÉRABLES" "PERSONNES-CONTENUES"
[<Benchmark>]
member __.EarlyAvm3() =
allTheWords |> replaceFirstItemAvm3 "MISÉRABLES" "PERSONNES-CONTENUES"
[<Benchmark>]
member __.EarlyAvm4() =
allTheWords |> replaceFirstItemAvm4 "MISÉRABLES" "PERSONNES-CONTENUES"
[<Benchmark>]
member __.EarlyAvm7() =
allTheWords |> replaceFirstItemAvm7 "MISÉRABLES" "PERSONNES-CONTENUES"
[<Benchmark>]
member __.EarlyAvm8() =
allTheWords |> replaceFirstItemAvm8 "MISÉRABLES" "PERSONNES-CONTENUES"
[<Benchmark>]
member __.Late() =
allTheWords |> replaceFirstItem "lichens" "BANANAS"
[<Benchmark>]
member __.LateCPS() =
allTheWords |> replaceFirstItemCPS "lichens" "BANANAS"
// [<Benchmark>]
member __.LateAvm1() =
allTheWords |> replaceFirstItemAvm1 "lichens" "BANANAS"
// [<Benchmark>]
member __.LateAvm2() =
allTheWords |> replaceFirstItemAvm2 "lichens" "BANANAS"
[<Benchmark>]
member __.LateAvm3() =
allTheWords |> replaceFirstItemAvm3 "lichens" "BANANAS"
[<Benchmark>]
member __.LateAvm4() =
allTheWords |> replaceFirstItemAvm4 "lichens" "BANANAS"
[<Benchmark>]
member __.LateAvm7() =
allTheWords |> replaceFirstItemAvm7 "lichens" "BANANAS"
[<Benchmark>]
member __.LateAvm8() =
allTheWords |> replaceFirstItemAvm8 "lichens" "BANANAS"
[<Benchmark>]
member __.NotFound() =
allTheWords |> replaceFirstItem "aWordThatNeverOccursInLesMisérables" "BANANAS"
[<Benchmark>]
member __.NotFoundCPS() =
allTheWords |> replaceFirstItemCPS "aWordThatNeverOccursInLesMisérables" "BANANAS"
// [<Benchmark>]
member __.NotFoundAvm1() =
allTheWords |> replaceFirstItemAvm1 "aWordThatNeverOccursInLesMisérables" "BANANAS"
// [<Benchmark>]
member __.NotFoundAvm2() =
allTheWords |> replaceFirstItemAvm2 "aWordThatNeverOccursInLesMisérables" "BANANAS"
[<Benchmark>]
member __.NotFoundAvm3() =
allTheWords |> replaceFirstItemAvm3 "aWordThatNeverOccursInLesMisérables" "BANANAS"
[<Benchmark>]
member __.NotFoundAvm4() =
allTheWords |> replaceFirstItemAvm4 "aWordThatNeverOccursInLesMisérables" "BANANAS"
[<Benchmark>]
member __.NotFoundAvm7() =
allTheWords |> replaceFirstItemAvm7 "aWordThatNeverOccursInLesMisérables" "BANANAS"
[<Benchmark>]
member __.NotFoundAvm8() =
allTheWords |> replaceFirstItemAvm8 "aWordThatNeverOccursInLesMisérables" "BANANAS"