...
  View open merge request
Commits (90)
......@@ -10,6 +10,8 @@ perf.data
perf.data.*
dist-newstyle/
.ghc.environment.*
_make
tags
# Specific generated files
nofib-analyse/nofib-analyse
......
variables:
DOCKER_REV: 2b69e99de97bd5bf1fbdbf45852231c3dcb602b6
DOCKER_REV: ba119705df5222fe74208a85019cb980e2c4318f
validate:
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb9:$DOCKER_REV"
validate-hadrian:
image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV"
tags:
- x86_64-linux
before_script:
- git clean -xdf
- sudo apt install -y time
- ghc --version
- cabal --version
script:
- make clean
- git submodule update --init --recursive
- GHC=/opt/ghc/$GHC_VERSION/bin/ghc
- $GHC --version
- cabal update
- make boot mode=fast
- "make mode=fast NoFibRuns=1 2>&1 | tee log"
- "nofib-analyse/nofib-analyse log"
- |
# The following checks that `make distclean` removes any files reported
# by `git clean -fxd`
make distclean
files=$(git clean -nxd | cut -d" " -f3 | sed "/log/d")
if ! [ -z $files ]
then
echo "The following files weren't cleaned:\n$files"
exit 1
fi
- cabal new-run nofib-run -- -o out -w $GHC
- mkdir -p results
- $GHC --info > results/compiler-info
- cp _make/out/*.results.tsv results
artifacts:
paths:
- results
......@@ -149,7 +149,17 @@ Optionally combine this with `mode=fast`, see [Modes](#modes).
Some benchmarks aren't run by default and require extra packages are
installed for the GHC compiler being tested. These packages include:
* stm - for smp benchmarks
* `old-time`: for `gc` benchmarks
* `stm`: for smp benchmarks
* `parallel`: for parallel benchmarks
* `random`: for various benchmarks
These can be installed with
```
cabal v1-install --allow-newer -w $HC random parallel old-time
````
## Adding benchmarks
......@@ -208,13 +218,23 @@ Gen 1 heaps just amplifies the problem.
As a rule of thumb on how to ensure this: Make sure that your benchmark doesn't
just build up one big data and consume it in a final step, but rather that the
working set grows and shrinks (e.g. is approximately constant) over the whole
run of the benchmark. You can ensure this by iterating your main logic $n times
(how often depends on your program, but in the ball park of 100-1000).
run of the benchmark. You can ensure this by iterating your main logic `$n`
times (how often depends on your program, but in the ball park of 100-1000).
You can test stability by plotting productivity curves for your `fast` settings
with the `prod.py` script attached to #15999.
If in doubt, ask Sebastian Graf for help.
## Important notes
Note that some of these tests (e.g. `spectral/fish`) tend to be very sensitive
to branch predictor effectiveness. This means that changes in the compiler
can easily be masked by "random" fluctuations in the code layout produced by
particular compiler runs. Recent GHC versions provide the `-fproc-alignment`
flag to pad procedures, ensuring slightly better stability across runs. If you
are seeing an unexpected change in performance try adding `-fproc-alignment=64`
the compiler flags of both your baseline and test tree.
## easy.sh
```
......
packages: shake
-- source-repository-package
-- type: git
-- location: https://github.com/bgamari/tabular
-- tag: 204b01f63dec6bf0e0aba2862c71e77b2ec3909b
......@@ -2,10 +2,10 @@ TOP = ../..
include $(TOP)/mk/boilerplate.mk
ifeq "$(HEAP)" "LARGE"
SRC_RUNTEST_OPTS += +RTS -H16m -RTS
PROG_ARGS += +RTS -H16m -RTS
endif
ifeq "$(HEAP)" "OLD"
SRC_RUNTEST_OPTS += +RTS -H10m -RTS
PROG_ARGS += +RTS -H10m -RTS
endif
include $(TOP)/mk/target.mk
......
......@@ -7,10 +7,10 @@ NORM_OPTS = 8 3000
SLOW_OPTS = 8 5000
ifeq "$(HEAP)" "LARGE"
SRC_RUNTEST_OPTS += +RTS -H256m -RTS
PROG_ARGS += +RTS -H256m -RTS
endif
ifeq "$(HEAP)" "OLD"
SRC_RUNTEST_OPTS += +RTS -H30m -RTS
PROG_ARGS += +RTS -H30m -RTS
endif
include $(TOP)/mk/target.mk
......@@ -7,10 +7,10 @@ NORM_OPTS = 10
SLOW_OPTS = 11
ifeq "$(HEAP)" "LARGE"
SRC_RUNTEST_OPTS += +RTS -H330m -RTS
PROG_ARGS += +RTS -H330m -RTS
endif
ifeq "$(HEAP)" "OLD"
SRC_RUNTEST_OPTS += +RTS -H10m -RTS
PROG_ARGS += +RTS -H10m -RTS
endif
include $(TOP)/mk/target.mk
......@@ -75,7 +75,7 @@ the roots of two binomial trees and makes the larger a child of the
smaller (thus bumping its degree by one). It is essential that this
only be called on binomial trees of equal degree.
>link (a @ (Node x as)) (b @ (Node y bs)) =
>link (a@(Node x as)) (b@(Node y bs)) =
> if x <= y then Node x (b:as) else Node y (a:bs)
It will also be useful to extract the minimum element from a tree.
......
......@@ -3,14 +3,14 @@ include $(TOP)/mk/boilerplate.mk
NORM_OPTS = 300000
SRC_HC_OPTS += -package array
SRC_RUNTEST_OPTS += +RTS -K64m -RTS
SRC_DEPS = array
PROG_ARGS += +RTS -K64m -RTS
ifeq "$(HEAP)" "LARGE"
SRC_RUNTEST_OPTS += +RTS -H128m -RTS
PROG_ARGS += +RTS -H128m -RTS
endif
ifeq "$(HEAP)" "OLD"
SRC_RUNTEST_OPTS += +RTS -H10m -RTS
PROG_ARGS += +RTS -H10m -RTS
endif
include $(TOP)/mk/target.mk
......@@ -195,19 +195,19 @@ calc (Geom a (RotZ rad)) rgb xyz
-- conflate matrices together and into planes planes...
reduceM (Object X) mata
= case (mat1x4 (1,0,0,0) mata) of
(x,y,z,w) -> (Object (Plane x y z w),True)
(x,y,z,w) -> (Object (Plane x y z w),True)
reduceM (Object Y) mata
= case (mat1x4 (0,1,0,0) mata) of
(x,y,z,w) -> (Object (Plane x y z w),True)
(x,y,z,w) -> (Object (Plane x y z w),True)
reduceM (Object Z) mata
= case (mat1x4 (0,0,1,0) mata) of
(x,y,z,w) -> (Object (Plane x y z w),True)
(x,y,z,w) -> (Object (Plane x y z w),True)
reduceM (Object (Plane a b c d)) mata
= case (mat1x4 (a,b,c,d) mata) of
(x,y,z,w) -> (Object (Plane x y z w),True)
(x,y,z,w) -> (Object (Plane x y z w),True)
reduceM (Matrix b matb) mata
= case (mat4x4 mata matb) of
matc -> (Matrix b matc,True)
matc -> (Matrix b matc,True)
reduceM _ _ = (no,False)
......
......@@ -18,10 +18,10 @@
-}
module Interval(Interval, (#), pt, sqr,
tophalf, bothalf, topbit,
lo, hi, mid1, mid2,
up,down,unpt)
where
tophalf, bothalf, topbit,
lo, hi, mid1, mid2,
up,down,unpt)
where
infix 4 #,:#:
......@@ -46,38 +46,38 @@ instance (Ord a) => Ord (Interval a) where
instance (Num a,Ord a,Eq a,Show{-was:Text-} a) => Num (Interval a) where
(+) = ivPlus
(*) = ivMult
negate = ivNegate
abs = ivAbs
signum = ivSignum
fromInteger = ivFromInteger
(+) = ivPlus
(*) = ivMult
negate = ivNegate
abs = ivAbs
signum = ivSignum
fromInteger = ivFromInteger
instance (Show a,Num a,Ord a,Fractional a) => Fractional (Interval a) where
(/) = ivDiv
fromRational = ivFromRational
(/) = ivDiv
fromRational = ivFromRational
-- instance (Fractional a,Ord a,Floating a) => - not this ?
instance (Show a,RealFloat a) =>
Floating (Interval a) where
pi = Pt pi
exp = ivExp
log = ivLog
sqrt = ivSqrt
(**) = ivPower
sin = ivSin
cos = ivCos
tan = ivTan
asin = ivAsin
acos = ivAcos
atan = ivAtan
sinh = ivSinh
cosh = ivCosh
tanh = ivTanh
asinh = ivAsinh
acosh = ivAcosh
atanh = ivAtanh
Floating (Interval a) where
pi = Pt pi
exp = ivExp
log = ivLog
sqrt = ivSqrt
(**) = ivPower
sin = ivSin
cos = ivCos
tan = ivTan
asin = ivAsin
acos = ivAcos
atan = ivAtan
sinh = ivSinh
cosh = ivCosh
tanh = ivTanh
asinh = ivAsinh
acosh = ivAcosh
atanh = ivAtanh
-- Error functions - un-used.
......@@ -141,35 +141,35 @@ ivNegate (a :#: b) = negate b :#: negate a
ivMult (Pt a) (Pt c) = Pt (a*c)
ivMult (a :#: b) (c :#: d) | (min a c) > 0 = a*c :#: b*d
| (max b d) < 0 = b*d :#: a*c
| otherwise = minmax [e,f,g,h]
where
e = b * c
f = a * d
g = a * c
h = b * d
| otherwise = minmax [e,f,g,h]
where
e = b * c
f = a * d
g = a * c
h = b * d
ivMult (Pt a) (c :#: d) | a > 0 = a*c :#: a*d
| a < 0 = a*d :#: a*c
| otherwise = (Pt 0)
| a < 0 = a*d :#: a*c
| otherwise = (Pt 0)
ivMult (c :#: d) (Pt a) | a > 0 = a*c :#: a*d
| a < 0 = a*d :#: a*c
| otherwise = (Pt 0)
| a < 0 = a*d :#: a*c
| otherwise = (Pt 0)
-- minmax finds the lowest, and highest in a list - used for mult.
-- Should use foldl rather than foldr
minmax [a] = a :#: a
minmax (a:as) = case True of
True | (a > s) -> f :#: a
True | (a < f) -> a :#: s
otherwise -> f :#: s
True | (a > s) -> f :#: a
True | (a < f) -> a :#: s
otherwise -> f :#: s
where
(f :#: s) = minmax as
ivAbs (Pt a) = Pt (abs a)
ivAbs (a :#: b) | a<=0 && 0<=b = 0 :#: (max (abs a) (abs b))
| a<=b && b<0 = b :#: a
| 0<a && a<=b = a :#: b
| otherwise = error "abs doesny work!"
| a<=b && b<0 = b :#: a
| 0<a && a<=b = a :#: b
| otherwise = error "abs doesny work!"
ivSignum (Pt a) = Pt (signum a)
ivSignum (a :#: b) = (signum a) :#: (signum b)
......@@ -195,7 +195,7 @@ ivLog (a :#: b) = (log a) :#: (log b)
ivSqrt (Pt a) = Pt (sqrt a)
ivSqrt (a :#: b) = (sqrt a) :#: (sqrt b)
ivPower x y = exp (log x * y) -- Optimise for x ** 2
ivPower x y = exp (log x * y) -- Optimise for x ** 2
ivSin :: (Floating a) => (Interval a) -> (Interval a)
......
......@@ -43,133 +43,133 @@ mkcolor x y z = RGB a b c
c = (z / 255.0) :: FType
white = mkcolor 255 255 255
ivory = mkcolor 255 255 240
light_yellow = mkcolor 255 255 224
yellow = mkcolor 255 255 0
snow = mkcolor 255 250 250
floral_white = mkcolor 255 250 240
lemon_chiffon = mkcolor 255 250 205
cornsilk = mkcolor 255 248 220
seashell = mkcolor 255 245 238
lavender_blush = mkcolor 255 240 245
papaya_whip = mkcolor 255 239 213
blanched_almond = mkcolor 255 235 205
misty_rose = mkcolor 255 228 225
bisque = mkcolor 255 228 196
moccasin = mkcolor 255 228 181
navajo_white = mkcolor 255 222 173
peach_puff = mkcolor 255 218 185
gold = mkcolor 255 215 0
pink = mkcolor 255 192 203
light_pink = mkcolor 255 182 193
orange = mkcolor 255 165 0
light_salmon = mkcolor 255 160 122
dark_orange = mkcolor 255 140 0
coral = mkcolor 255 127 80
hot_pink = mkcolor 255 105 180
tomato = mkcolor 255 99 71
orange_red = mkcolor 255 69 0
deep_pink = mkcolor 255 20 147
magenta = mkcolor 255 0 255
red = mkcolor 255 0 0
old_lace = mkcolor 253 245 230
light_goldenrod_yellow = mkcolor 250 250 210
linen = mkcolor 250 240 230
antique_white = mkcolor 250 235 215
salmon = mkcolor 250 128 114
ghost_white = mkcolor 248 248 255
mint_cream = mkcolor 245 255 250
white_smoke = mkcolor 245 245 245
beige = mkcolor 245 245 220
wheat = mkcolor 245 222 179
sandy_brown = mkcolor 244 164 96
azure = mkcolor 240 255 255
honeydew = mkcolor 240 255 240
alice_blue = mkcolor 240 248 255
khaki = mkcolor 240 230 140
light_coral = mkcolor 240 128 128
pale_goldenrod = mkcolor 238 232 170
light_goldenrod = mkcolor 238 221 130
violet = mkcolor 238 130 238
dark_salmon = mkcolor 233 150 122
lavender = mkcolor 230 230 250
light_cyan = mkcolor 224 255 255
burlywood = mkcolor 222 184 135
plum = mkcolor 221 160 221
gainsboro = mkcolor 220 220 220
pale_violet_red = mkcolor 219 112 147
goldenrod = mkcolor 218 165 32
orchid = mkcolor 218 112 214
thistle = mkcolor 216 191 216
light_grey = mkcolor 211 211 211
-- tan = mkcolor 210 180 140
chocolate = mkcolor 210 105 30
violet_red = mkcolor 208 32 144
peru = mkcolor 205 133 63
indian_red = mkcolor 205 92 92
medium_violet_red = mkcolor 199 21 133
grey = mkcolor 190 190 190
dark_khaki = mkcolor 189 183 107
rosy_brown = mkcolor 188 143 143
medium_orchid = mkcolor 186 85 211
dark_goldenrod = mkcolor 184 134 11
firebrick = mkcolor 178 34 34
powder_blue = mkcolor 176 224 230
light_steel_blue = mkcolor 176 196 222
maroon = mkcolor 176 48 96
pale_turquoise = mkcolor 175 238 238
green_yellow = mkcolor 173 255 47
light_blue = mkcolor 173 216 230
brown = mkcolor 165 42 42
sienna = mkcolor 160 82 45
purple = mkcolor 160 32 240
yellow_green = mkcolor 154 205 50
dark_orchid = mkcolor 153 50 204
pale_green = mkcolor 152 251 152
dark_violet = mkcolor 148 0 211
medium_purple = mkcolor 147 112 219
dark_sea_green = mkcolor 143 188 143
saddle_brown = mkcolor 139 69 19
blue_violet = mkcolor 138 43 226
light_sky_blue = mkcolor 135 206 250
sky_blue = mkcolor 135 206 235
light_slate_blue = mkcolor 132 112 255
aquamarine = mkcolor 127 255 212
chartreuse = mkcolor 127 255 0
lawn_green = mkcolor 124 252 0
medium_slate_blue = mkcolor 123 104 238
light_slate_grey = mkcolor 119 136 153
slate_grey = mkcolor 112 128 144
olive_drab = mkcolor 107 142 35
slate_blue = mkcolor 106 90 205
dim_grey = mkcolor 105 105 105
medium_aquamarine = mkcolor 102 205 170
cornflower_blue = mkcolor 100 149 237
cadet_blue = mkcolor 95 158 160
dark_olive_green = mkcolor 85 107 47
medium_turquoise = mkcolor 72 209 204
dark_slate_blue = mkcolor 72 61 139
steel_blue = mkcolor 70 130 180
royal_blue = mkcolor 65 105 225
turquoise = mkcolor 64 224 208
medium_sea_green = mkcolor 60 179 113
lime_green = mkcolor 50 205 50
dark_slate_grey = mkcolor 47 79 79
sea_green = mkcolor 46 139 87
forest_green = mkcolor 34 139 34
light_sea_green = mkcolor 32 178 170
dodger_blue = mkcolor 30 144 255
midnight_blue = mkcolor 25 25 112
cyan = mkcolor 0 255 255
spring_green = mkcolor 0 255 127
green = mkcolor 0 255 0
medium_spring_green = mkcolor 0 250 154
dark_turquoise = mkcolor 0 206 209
deep_sky_blue = mkcolor 0 191 255
dark_green = mkcolor 0 100 0
blue = mkcolor 0 0 255
medium_blue = mkcolor 0 0 205
navy_blue = mkcolor 0 0 128
navy = mkcolor 0 0 128
black = mkcolor 0 0 0
white = mkcolor 255 255 255
ivory = mkcolor 255 255 240
light_yellow = mkcolor 255 255 224
yellow = mkcolor 255 255 0
snow = mkcolor 255 250 250
floral_white = mkcolor 255 250 240
lemon_chiffon = mkcolor 255 250 205
cornsilk = mkcolor 255 248 220
seashell = mkcolor 255 245 238
lavender_blush = mkcolor 255 240 245
papaya_whip = mkcolor 255 239 213
blanched_almond = mkcolor 255 235 205
misty_rose = mkcolor 255 228 225
bisque = mkcolor 255 228 196
moccasin = mkcolor 255 228 181
navajo_white = mkcolor 255 222 173
peach_puff = mkcolor 255 218 185
gold = mkcolor 255 215 0
pink = mkcolor 255 192 203
light_pink = mkcolor 255 182 193
orange = mkcolor 255 165 0
light_salmon = mkcolor 255 160 122
dark_orange = mkcolor 255 140 0
coral = mkcolor 255 127 80
hot_pink = mkcolor 255 105 180
tomato = mkcolor 255 99 71
orange_red = mkcolor 255 69 0
deep_pink = mkcolor 255 20 147
magenta = mkcolor 255 0 255
red = mkcolor 255 0 0
old_lace = mkcolor 253 245 230
light_goldenrod_yellow = mkcolor 250 250 210
linen = mkcolor 250 240 230
antique_white = mkcolor 250 235 215
salmon = mkcolor 250 128 114
ghost_white = mkcolor 248 248 255
mint_cream = mkcolor 245 255 250
white_smoke = mkcolor 245 245 245
beige = mkcolor 245 245 220
wheat = mkcolor 245 222 179
sandy_brown = mkcolor 244 164 96
azure = mkcolor 240 255 255
honeydew = mkcolor 240 255 240
alice_blue = mkcolor 240 248 255
khaki = mkcolor 240 230 140
light_coral = mkcolor 240 128 128
pale_goldenrod = mkcolor 238 232 170
light_goldenrod = mkcolor 238 221 130
violet = mkcolor 238 130 238
dark_salmon = mkcolor 233 150 122
lavender = mkcolor 230 230 250
light_cyan = mkcolor 224 255 255
burlywood = mkcolor 222 184 135
plum = mkcolor 221 160 221
gainsboro = mkcolor 220 220 220
pale_violet_red = mkcolor 219 112 147
goldenrod = mkcolor 218 165 32
orchid = mkcolor 218 112 214
thistle = mkcolor 216 191 216
light_grey = mkcolor 211 211 211
-- tan = mkcolor 210 180 140
chocolate = mkcolor 210 105 30
violet_red = mkcolor 208 32 144
peru = mkcolor 205 133 63
indian_red = mkcolor 205 92 92
medium_violet_red = mkcolor 199 21 133
grey = mkcolor 190 190 190
dark_khaki = mkcolor 189 183 107
rosy_brown = mkcolor 188 143 143
medium_orchid = mkcolor 186 85 211
dark_goldenrod = mkcolor 184 134 11
firebrick = mkcolor 178 34 34
powder_blue = mkcolor 176 224 230
light_steel_blue = mkcolor 176 196 222
maroon = mkcolor 176 48 96
pale_turquoise = mkcolor 175 238 238
green_yellow = mkcolor 173 255 47
light_blue = mkcolor 173 216 230
brown = mkcolor 165 42 42
sienna = mkcolor 160 82 45
purple = mkcolor 160 32 240
yellow_green = mkcolor 154 205 50
dark_orchid = mkcolor 153 50 204
pale_green = mkcolor 152 251 152
dark_violet = mkcolor 148 0 211
medium_purple = mkcolor 147 112 219
dark_sea_green = mkcolor 143 188 143
saddle_brown = mkcolor 139 69 19
blue_violet = mkcolor 138 43 226
light_sky_blue = mkcolor 135 206 250
sky_blue = mkcolor 135 206 235
light_slate_blue = mkcolor 132 112 255
aquamarine = mkcolor 127 255 212
chartreuse = mkcolor 127 255 0
lawn_green = mkcolor 124 252 0
medium_slate_blue = mkcolor 123 104 238
light_slate_grey = mkcolor 119 136 153
slate_grey = mkcolor 112 128 144
olive_drab = mkcolor 107 142 35
slate_blue = mkcolor 106 90 205
dim_grey = mkcolor 105 105 105
medium_aquamarine = mkcolor 102 205 170
cornflower_blue = mkcolor 100 149 237
cadet_blue = mkcolor 95 158 160
dark_olive_green = mkcolor 85 107 47
medium_turquoise = mkcolor 72 209 204
dark_slate_blue = mkcolor 72 61 139
steel_blue = mkcolor 70 130 180
royal_blue = mkcolor 65 105 225
turquoise = mkcolor 64 224 208
medium_sea_green = mkcolor 60 179 113
lime_green = mkcolor 50 205 50
dark_slate_grey = mkcolor 47 79 79
sea_green = mkcolor 46 139 87
forest_green = mkcolor 34 139 34
light_sea_green = mkcolor 32 178 170
dodger_blue = mkcolor 30 144 255
midnight_blue = mkcolor 25 25 112
cyan = mkcolor 0 255 255
spring_green = mkcolor 0 255 127
green = mkcolor 0 255 0
medium_spring_green = mkcolor 0 250 154
dark_turquoise = mkcolor 0 206 209
deep_sky_blue = mkcolor 0 191 255
dark_green = mkcolor 0 100 0
blue = mkcolor 0 0 255
medium_blue = mkcolor 0 0 205
navy_blue = mkcolor 0 0 128
navy = mkcolor 0 0 128
black = mkcolor 0 0 0
......@@ -37,9 +37,9 @@ import System.IO
main = do
argv <- getArgs
let
n = case argv of
[a] -> read a
_ -> 7
n = case argv of
[a] -> read a
_ -> 7
hSetBinaryMode stdin True
hSetBinaryMode stdout True
putStr (picture n)
......
TOP = ../..
include $(TOP)/mk/boilerplate.mk
SRC_HC_OPTS += -cpp
# Bah.hs is a test file, which we don't want in SRCS
EXCLUDED_SRCS = Bah.hs
......@@ -11,10 +9,10 @@ NORM_OPTS = 9
SLOW_OPTS = 9
ifeq "$(HEAP)" "LARGE"
SRC_RUNTEST_OPTS += +RTS -H160m -RTS
PROG_ARGS += +RTS -H160m -RTS
endif
ifeq "$(HEAP)" "OLD"
SRC_RUNTEST_OPTS += +RTS -H10m -RTS
PROG_ARGS += +RTS -H10m -RTS
endif
SRC_RUNTEST_OPTS += -stdout-binary
......
......@@ -33,10 +33,10 @@ dorow :: (Fractional a) => Row -> R3 a -> a
dorow (m11,m12,m13,m14) (x,y,z)
= case (m1 * x) + (m2 * y) + (m3 * z) + m4 of n -> n
where
m1 = realToFrac m11
m2 = realToFrac m12
m3 = realToFrac m13
m4 = realToFrac m14
m1 = realToFrac m11
m2 = realToFrac m12
m3 = realToFrac m13
m4 = realToFrac m14
mat4x1' :: (Fractional a) => Arr -> R3 a -> R3 a
mat4x1' (r1,r2,r3) xyz = (x,y,z)
......@@ -49,9 +49,9 @@ dorow' :: (Fractional a) => Row -> R3 a -> a
dorow' (m11,m12,m13,m14) (x,y,z)
= case (m1 * x) + (m2 * y) + (m3 * z) of n -> n
where
m1 = realToFrac m11
m2 = realToFrac m12
m3 = realToFrac m13
m1 = realToFrac m11
m2 = realToFrac m12
m3 = realToFrac m13
mat1x4 :: Row -> Arr -> Row
mat1x4 a (b1,b2,b3) = (c1,c2,c3,c4)
......
......@@ -46,7 +46,7 @@ makeoct csg = octer 1 csg xyz
-- octer :: Int -> Csg -> (R3 BI) -> Oct
octer nn csg xyz
= case (calc csg white xyz) of
(res,newc',rgb,new) ->
(res,newc',rgb,new) ->
let
newc = if new then newc' else csg
c = light rgb (calcn newc xyz)
......@@ -54,35 +54,35 @@ octer nn csg xyz
bhx = bothalf x ; thx = tophalf x
bhy = bothalf y ; thy = tophalf y
tbz = topbit z ; bhz = bothalf z
os = if nn == 1 then osb else osa
n1 = nn + 1
os = if nn == 1 then osb else osa
n1 = nn + 1
osa = map (octer n1 newc)
[ (bhx,bhy,tbz) , (bhx,bhy,bhz) ,
(thx,bhy,tbz) , (thx,bhy,bhz) ,
(bhx,thy,tbz) , (bhx,thy,bhz) ,
(thx,thy,tbz) , (thx,thy,bhz) ]
(thx,bhy,tbz) , (thx,bhy,bhz) ,
(bhx,thy,tbz) , (bhx,thy,bhz) ,
(thx,thy,tbz) , (thx,thy,bhz) ]
osb = [(octer n1 newc (bhx,bhy,tbz)) ,
(octer n1 newc (bhx,bhy,bhz)) ,
(octer n1 newc (thx,bhy,tbz)) ,
(octer n1 newc (thx,bhy,bhz)) ,
(octer n1 newc (bhx,thy,tbz)) ,
(octer n1 newc (bhx,thy,bhz)) ,
(octer n1 newc (thx,thy,tbz)) ,
(octer n1 newc (thx,thy,bhz)) ]
(octer n1 newc (bhx,bhy,bhz)) ,
(octer n1 newc (thx,bhy,tbz)) ,
(octer n1 newc (thx,bhy,bhz)) ,
(octer n1 newc (bhx,thy,tbz)) ,
(octer n1 newc (bhx,thy,bhz)) ,
(octer n1 newc (thx,thy,tbz)) ,
(octer n1 newc (thx,thy,bhz)) ]
in
if res < (pt 0) then
O_Full c
else if res > (pt 0) then
O_Empty
else
O_Sub c os
if res < (pt 0) then
O_Full c
else if res > (pt 0) then
O_Empty
else
O_Sub c os
{-
os = map (octer newc)
[ (bhx,bhy,tbz) , (bhx,bhy,bhz) ,
(thx,bhy,tbz) , (thx,bhy,bhz) ,
(bhx,thy,tbz) , (bhx,thy,bhz) ,
(thx,thy,tbz) , (thx,thy,bhz) ]
(thx,bhy,tbz) , (thx,bhy,bhz) ,
(bhx,thy,tbz) , (bhx,thy,bhz) ,
(thx,thy,tbz) , (thx,thy,bhz) ]
-}
calcn csg xyz = normalise (makevector f0 f1 f2 f3)
......
......@@ -34,7 +34,7 @@ qo (O_Sub s l) (Q_Empty ) = Q_Sub s z
(l2:ll3) = ll2 ; (l3:ll4) = ll3
(l4:ll5) = ll4 ; (l5:ll6) = ll5
(l6:ll7) = ll6 ; (l7:ll8) = ll7
z = [ qo (l1) (qo (l0) Q_Empty) ,
z = [ qo (l1) (qo (l0) Q_Empty) ,
qo (l3) (qo (l2) Q_Empty) ,
qo (l5) (qo (l4) Q_Empty) ,
qo (l7) (qo (l6) Q_Empty) ]
......@@ -46,7 +46,7 @@ qo (O_Sub s l) (Q_Sub t k) = Q_Sub t z
(l6:ll7) = ll6 ; (l7:ll8) = ll7
(k0:kk1) = k ; (k1:kk2) = kk1
(k2:kk3) = kk2 ; (k3:kk4) = kk3
z = [ qo (l1) (qo (l0) (k0)) ,
z = [ qo (l1) (qo (l0) (k0)) ,
qo (l3) (qo (l2) (k1)) ,
qo (l5) (qo (l4) (k2)) ,
qo (l7) (qo (l6) (k3)) ]
......@@ -54,7 +54,7 @@ qo o@(O_Full s) (Q_Sub t k) = Q_Sub t z
where
(k0:kk1) = k ; (k1:kk2) = kk1
(k2:kk3) = kk2 ; (k3:kk4) = kk3
z = [ qo o (k0) , qo o (k1) ,
z = [ qo o (k0) , qo o (k1) ,
qo o (k2) , qo o (k3) ]
qo (O_Full s ) (q ) = Q_Full s
......@@ -37,14 +37,14 @@ data Prim = Sphere FType FType FType FType
| Cube FType FType FType FType
| Plane FType FType FType FType
| X | Y | Z
deriving Show{-was:Text-}
deriving Show{-was:Text-}
data Ops = RotX FType
| RotY FType
| RotZ FType
| Scale FType FType FType
| Trans FType FType FType
deriving Show{-was:Text-}
deriving Show{-was:Text-}
data Csg = Object Prim
| Geom Csg Ops
......@@ -55,7 +55,7 @@ data Csg = Object Prim
| Inter Csg Csg
| Sub Csg Csg
| Comp Csg
-- deriving Show{-was:Text-}
-- deriving Show{-was:Text-}
-- type CsgOut = (R1 BI,Csg,Color,Bool)
......@@ -68,7 +68,7 @@ type Calc = Color -> (R3 BI) -> CsgOut
----------------------------------------------------------
data Color = RGB FType FType FType
deriving Show{-was:Text-}
deriving Show{-was:Text-}
----------------------------------------------------------
-- Matrix
......@@ -89,7 +89,7 @@ type R1 a = (a,a)
----------------------------------------------------------
data Oct = O_Full Color | O_Empty | O_Sub Color [Oct]
deriving Show{-was:Text-}
deriving Show{-was:Text-}
----------------------------------------------------------
-- Quad
......@@ -98,7 +98,7 @@ data Oct = O_Full Color | O_Empty | O_Sub Color [Oct]
data Quad = Q_Empty | Q_Full Color
| Q_Sub Color [Quad]
| Q_NewXY FType FType FType
deriving Show{-was:Text-}
deriving Show{-was:Text-}
----------------------------------------------------------
-- Vector
......
......@@ -38,7 +38,7 @@ len :: Vector -> FType
len (x,y,z) = ans
where
ans | sqs /= 0.0 = sqrt sqs
| True = 1
| True = 1
sqs :: FType
sqs = (x2 + y2 + z2)
x2 = x * x
......
......@@ -3,122 +3,122 @@
// of Post Communications.
// It was modified by Hans Boehm of Silicon Graphics.
//
// This is no substitute for real applications. No actual application
// is likely to behave in exactly this way. However, this benchmark was
// designed to be more representative of real applications than other
// Java GC benchmarks of which we are aware.
// It attempts to model those properties of allocation requests that
// are important to current GC techniques.
// It is designed to be used either to obtain a single overall performance
// number, or to give a more detailed estimate of how collector
// performance varies with object lifetimes. It prints the time
// required to allocate and collect balanced binary trees of various
// sizes. Smaller trees result in shorter object lifetimes. Each cycle
// allocates roughly the same amount of memory.
// Two data structures are kept around during the entire process, so
// that the measured performance is representative of applications
// that maintain some live in-memory data. One of these is a tree
// containing many pointers. The other is a large array containing
// double precision floating point numbers. Both should be of comparable
// size.
// This is no substitute for real applications. No actual application
// is likely to behave in exactly this way. However, this benchmark was
// designed to be more representative of real applications than other
// Java GC benchmarks of which we are aware.
// It attempts to model those properties of allocation requests that
// are important to current GC techniques.
// It is designed to be used either to obtain a single overall performance
// number, or to give a more detailed estimate of how collector
// performance varies with object lifetimes. It prints the time
// required to allocate and collect balanced binary trees of various
// sizes. Smaller trees result in shorter object lifetimes. Each cycle
// allocates roughly the same amount of memory.
// Two data structures are kept around during the entire process, so
// that the measured performance is representative of applications
// that maintain some live in-memory data. One of these is a tree
// containing many pointers. The other is a large array containing
// double precision floating point numbers. Both should be of comparable
// size.
//
// The results are only really meaningful together with a specification
// of how much memory was used. It is possible to trade memory for
// better time performance. This benchmark should be run in a 32 MB
// heap, though we don't currently know how to enforce that uniformly.
// The results are only really meaningful together with a specification
// of how much memory was used. It is possible to trade memory for
// better time performance. This benchmark should be run in a 32 MB
// heap, though we don't currently know how to enforce that uniformly.
//
// Unlike the original Ellis and Kovac benchmark, we do not attempt
// measure pause times. This facility should eventually be added back
// in. There are several reasons for omitting it for now. The original
// implementation depended on assumptions about the thread scheduler
// that don't hold uniformly. The results really measure both the
// scheduler and GC. Pause time measurements tend to not fit well with
// current benchmark suites. As far as we know, none of the current
// commercial Java implementations seriously attempt to minimize GC pause
// times.
// Unlike the original Ellis and Kovac benchmark, we do not attempt
// measure pause times. This facility should eventually be added back
// in. There are several reasons for omitting it for now. The original
// implementation depended on assumptions about the thread scheduler
// that don't hold uniformly. The results really measure both the
// scheduler and GC. Pause time measurements tend to not fit well with
// current benchmark suites. As far as we know, none of the current
// commercial Java implementations seriously attempt to minimize GC pause
// times.
//
// Known deficiencies:
// - No way to check on memory use
// - No cyclic data structures
// - No attempt to measure variation with object size
// - Results are sensitive to locking cost, but we dont
// check for proper locking
// Known deficiencies:
// - No way to check on memory use
// - No cyclic data structures
// - No attempt to measure variation with object size
// - Results are sensitive to locking cost, but we dont
// check for proper locking
class Node {
Node left, right;
int i, j;
Node(Node l, Node r) { left = l; right = r; }
Node() { }
Node left, right;
int i, j;
Node(Node l, Node r) { left = l; right = r; }
Node() { }
}
public class GCBench {
public static final int kStretchTreeDepth = 18; // about 16Mb
public static final int kLongLivedTreeDepth = 16; // about 4Mb
public static final int kArraySize = 500000; // about 4Mb
public static final int kMinTreeDepth = 4;
public static final int kMaxTreeDepth = 16;
public static final int kStretchTreeDepth = 18; // about 16Mb
public static final int kLongLivedTreeDepth = 16; // about 4Mb
public static final int kArraySize = 500000; // about 4Mb
public static final int kMinTreeDepth = 4;
public static final int kMaxTreeDepth = 16;
// Nodes used by a tree of a given size
static int TreeSize(int i) {
return ((1 << (i + 1)) - 1);
}
// Nodes used by a tree of a given size
static int TreeSize(int i) {
return ((1 << (i + 1)) - 1);
}
// Number of iterations to use for a given tree depth
static int NumIters(int i) {
// Number of iterations to use for a given tree depth
static int NumIters(int i) {
return 2 * TreeSize(kStretchTreeDepth) / TreeSize(i);
}
// Build tree top down, assigning to older objects.
static void Populate(int iDepth, Node thisNode) {
if (iDepth<=0) {
return;
} else {
iDepth--;
thisNode.left = new Node();
thisNode.right = new Node();
Populate (iDepth, thisNode.left);
Populate (iDepth, thisNode.right);
}
}
// Build tree bottom-up
static Node MakeTree(int iDepth) {
if (iDepth<=0) {
return new Node();
} else {
return new Node(MakeTree(iDepth-1),
MakeTree(iDepth-1));
}
}
static void PrintDiagnostics() {
long lFreeMemory = Runtime.getRuntime().freeMemory();
long lTotalMemory = Runtime.getRuntime().totalMemory();
System.out.print(" Total memory available="
+ lTotalMemory + " bytes");
System.out.println(" Free memory=" + lFreeMemory + " bytes");
}
static void TimeConstruction(int depth) {
Node root;
long tStart, tFinish;
int iNumIters = NumIters(depth);
Node tempTree;
System.out.println("Creating " + iNumIters +
" trees of depth " + depth);
tStart = System.currentTimeMillis();
for (int i = 0; i < iNumIters; ++i) {
tempTree = new Node();
Populate(depth, tempTree);
tempTree = null;
}
tFinish = System.currentTimeMillis();
System.out.println("\tTop down construction took "
+ (tFinish - tStart) + "msecs");
tStart = System.currentTimeMillis();
// Build tree top down, assigning to older objects.
static void Populate(int iDepth, Node thisNode) {
if (iDepth<=0) {
return;
} else {
iDepth--;
thisNode.left = new Node();
thisNode.right = new Node();
Populate (iDepth, thisNode.left);
Populate (iDepth, thisNode.right);
}
}
// Build tree bottom-up
static Node MakeTree(int iDepth) {
if (iDepth<=0) {
return new Node();
} else {
return new Node(MakeTree(iDepth-1),
MakeTree(iDepth-1));
}
}
static void PrintDiagnostics() {
long lFreeMemory = Runtime.getRuntime().freeMemory();
long lTotalMemory = Runtime.getRuntime().totalMemory();
System.out.print(" Total memory available="
+ lTotalMemory + " bytes");
System.out.println(" Free memory=" + lFreeMemory + " bytes");
}
static void TimeConstruction(int depth) {
Node root;
long tStart, tFinish;
int iNumIters = NumIters(depth);
Node tempTree;
System.out.println("Creating " + iNumIters +
" trees of depth " + depth);
tStart = System.currentTimeMillis();
for (int i = 0; i < iNumIters; ++i) {
tempTree = new Node();
Populate(depth, tempTree);
tempTree = null;
}