impressions on ghc-6.4
Serge D. Mechveliani
mechvel at botik.ru
Wed Jun 8 07:26:58 EDT 2005
Dear GHC developers and users,
Here are some impressions on ghc-6.4.
Cabal
-----
It looks good. Thanks to developers.
Long ago I asked for the building tool in GHC which would allow to
avoid composing Makefile-s, with their difficult syntax and odd-looking
system commands: `ar', `ld', and such.
Now, Cabal does what I asked for.
Remarks:
* maybe, `version' should not be mandatory in the package
specification?
* " version: 5.02 " (imagine "ghc-5.02") converts to "5.0.2" .
Could it allow digit sequences separated by period?
-O, memory management
---------------------
In ghc-6.2.2 the test for dumatel-1.02
runs 2 times faster when Dumatel is built under -O.
And in ghc-6.4, the time does not differ.
Then, I tried the benchmark with certain mixture of list operations:
user-written maximum and mergeSort, `reverse' and `zip' of GHC
-- find enclosed the source.
-O is 1.3 faster than -Onot.
The speed looks like in ghc-5.02 (I think, this is all right).
5.02 was able to run `main' for n = 55000 in 200 Kb memory.
6.4 needs 2600 Kb.
Probably, 5.02 is distinguished among other versions in memory
management.
Regards,
-----------------
Serge Mechveliani
mechvel at botik.ru
***************************************************************
-- the result of `main' must be n-1.
main = putStr $ shows (test 55000 ) "\n"
-- n
-- to edit
test :: Int -> Int
test n = max' $ sort' $ zipWith (-) (reverse xs) xs
where xs = [1..n]
max' :: Ord a => [a] -> a
max' [x] = x
max' (x:y:xs) = case compare x y of LT -> max' (y:xs)
_ -> max' (x:xs)
sort' :: Ord a => [a] -> [a]
sort' xs = s $ mergePairs [[x] | x <- xs]
where
s [] = []
s [xs] = xs
s xss = s $ mergePairs xss
mergePairs (xs:ys:zss) = (merge xs ys):(mergePairs zss)
mergePairs xss = xss
merge :: Ord a => [a] -> [a] -> [a]
merge [] ys = ys
merge xs [] = xs
merge (x:xs) (y:ys) = case compare x y of
GT -> y:(merge (x:xs) ys)
_ -> x:(merge xs (y:ys))
More information about the Glasgow-haskell-users
mailing list