-
Notifications
You must be signed in to change notification settings - Fork 22
/
Makefile
160 lines (119 loc) · 5.87 KB
/
Makefile
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
##############################################################################
## Benchmarks
##############################################################################
## Config
#########
GHC6 = ghc-6.12.3
GHC7 = ghc-7.0.2
GHC = $(GHC7)
GHCI = ghci-6.12.3
## All benchmarks
#################
bench-all: bench-compression bench-string-and-text bench-throughput bench-chunked-write
clean-bench-all:
rm -f benchmarks/*.o benchmarks/*.hi
rm -f benchmarks/Throughput/*.o benchmarks/Throughput/*.hi
rm -f Blaze/ByteString/Builder.o Blaze/ByteString/Builder.hi
rm -f Blaze/ByteString/Builder/*.o Blaze/ByteString/Builder/*.hi
rm -f Blaze/ByteString/Builder/Internal/*.o Blaze/ByteString/Builder/Internal/*.hi
rm -f Blaze/ByteString/Builder/Char/*.o Blaze/ByteString/Builder/Char/*.hi
rm -f Blaze/ByteString/Builder/Html/*.o Blaze/ByteString/Builder/Html/*.hi
rm -f Blaze/ByteString/Builder/Core/*.o Blaze/ByteString/Builder/Core/*.hi
rm -f benchmarks/Compression benchmarks/StringAndText benchmarks/BenchThroughput benchmarks/ChunkedWrite benchmarks/BlazeVsBinary
rm -f Criterion/*.o Criterion/*.hi
rm -f Criterion/ScalingBenchmark
## Individual benchmarks
########################
# utf8 writing to a file
utf8-io:
$(GHC) --make -O2 -fforce-recomp -main-is Utf8IO benchmarks/Utf8IO.hs
time ./benchmarks/Utf8IO via-text 100000000 /dev/null
time ./benchmarks/Utf8IO text 100000000 /dev/null
time ./benchmarks/Utf8IO blaze 100000000 /dev/null
time ./benchmarks/Utf8IO base 100000000 /dev/null
time ./benchmarks/Utf8IO utf8-light 100000000 /dev/null
time ./benchmarks/Utf8IO utf8-string 100000000 /dev/null
# 'blaze-builder' vs. 'binary' comparision
bench-blaze-vs-binary:
$(GHC) --make -O2 -fforce-recomp -main-is BlazeVsBinary benchmarks/BlazeVsBinary.hs
./benchmarks/BlazeVsBinary --resamples 10000
# throughput benchmarks: interactive development
ghci-throughput: benchmarks/Throughput/CBenchmark.o
$(GHCI) -O2 -fforce-recomp -ibenchmarks -main-is BenchThroughput benchmarks/Throughput/CBenchmark.o benchmarks/BenchThroughput.hs
bench-throughput: benchmarks/Throughput/CBenchmark.o
$(GHC) --make -O2 -fforce-recomp -fliberate-case-threshold=1000 -ibenchmarks -main-is BenchThroughput benchmarks/Throughput/CBenchmark.o benchmarks/BenchThroughput.hs
./benchmarks/BenchThroughput 100
benchmarks/Throughput/CBenchmark.o: benchmarks/Throughput/CBenchmark.c
gcc -O3 -c $< -o $@
# Benchmark benefit of serializing several list elements at once
bench-chunked-write:
$(GHC) --make -O2 -fforce-recomp -main-is ChunkedWrite benchmarks/ChunkedWrite.hs
./benchmarks/ChunkedWrite --resamples 10000
core-chunked-write:
ghc-core -- --make -O2 -fforce-recomp -main-is ChunkedWrite benchmarks/ChunkedWrite.hs
# Benchmark best serialization techniques for 'String' and 'Text'
bench-string-and-text:
$(GHC) --make -O2 -fforce-recomp -ibenchmarks -main-is StringAndText StringAndText
echo $(GHC)
./benchmarks/StringAndText --resamples 10000
# Benchmark benefit of compaction before compression
bench-compression:
$(GHC) --make -O2 -fforce-recomp -ibenchmarks -main-is Compression Compression
./benchmarks/Compression --resamples 10000
# Benchmark the use of unboxed continuation calls
bench-unboxed-append:
$(GHC) --make -O2 -fforce-recomp -ibenchmarks -main-is UnboxedAppend UnboxedAppend
./benchmarks/UnboxedAppend --resamples 10000
# Core of the use of unboxed continuation calls
core-unboxed-append:
ghc-core -- --make -O2 -fforce-recomp -main-is UnboxedAppend benchmarks/UnboxedAppend.hs
# Benchmark the cost of the Put monad vs. the Builder monoid
bench-put-vs-builder:
$(GHC) --make -O2 -fforce-recomp -ibenchmarks -main-is FastPut FastPut
./benchmarks/FastPut --resamples 10000
# Benchmark the cost/benefit of a more general write type
bench-bounded-write:
$(GHC7) --make -O2 -fforce-recomp -ibenchmarks -main-is BoundedWrite BoundedWrite
./benchmarks/BoundedWrite --resamples 10000
core-bounded-write:
ghc-core -- --make -O2 -fforce-recomp -main-is BoundedWrite benchmarks/BoundedWrite.hs
# Benchmark the benefit of using a packed representation for the buffer range
bench-buffer-range:
$(GHC) --make -O2 -fforce-recomp -ibenchmarks -main-is BuilderBufferRange BuilderBufferRange
./benchmarks/BuilderBufferRange --resamples 10000
# Benchmark improvements to lazy bytestring functions
bench-lazy-bytestring:
$(GHC) --make -O2 -fforce-recomp -ibenchmarks -main-is LazyByteString LazyByteString
./benchmarks/LazyByteString --resamples 10000
core-lazy-bytestring:
ghc-core -- --make -O2 -fforce-recomp -ibenchmarks -main-is LazyByteString LazyByteString
# Benchmark benefit of compaction before compression
bench-server:
$(GHC) --make -O2 -ibenchmarks -main-is BenchmarkServer BenchmarkServer
# ./benchmarks/BenchmarkServer --resamples 10000
./benchmarks/BenchmarkServer 9999 100000 +RTS -s&
ab -n 1000 localhost:9999/lbs
curl localhost:9999/kill > /dev/null 2>&1
##############################################################################
## Plots
##############################################################################
plot-all:
$(GHC) --make -O2 -fforce-recomp -main-is Criterion.ScalingBenchmark Criterion.ScalingBenchmark
./Criterion/ScalingBenchmark --resamples 10000
##############################################################################
## Tests
##############################################################################
test:
$(GHC) --make -fforce-recomp -O2 -itests -main-is Tests Tests
./tests/Tests
clean-tests:
rm -f tests/Tests tests/*.o tests/*.hi
ghci-llvm-segfault:
$(GHCI) -itests -main-is LlvmSegfault tests/LlvmSegfault
test-llvm-segfault:
ghc-7.0.0.20100924 --make -fllvm -itests -main-is LlvmSegfault tests/LlvmSegfault
./tests/LlvmSegfault
##############################################################################
## All inclusive targets
##############################################################################
clean: clean-tests clean-bench-all