Consider the following Haskell-definitions (maybe you recognize it =>
"Is efficient backtracking feasible in functional languages?"):
strangesucc :: Int -> Int
strangesucc n = head [x | x <- [0..], x > n]
Evaluating main = print (strangesucc n)
we obtain the following table:
n | GCs | alloc | user | mx | id
-------+-----+----------+------+------+-------
100000 | 30 | 6001368 | 1.25 | 240 | 29927 overloaded
200000 | 61 | 12001368 | 2.42 | 242 | 59174
100000 | 3 | 2401236 | 0.81 | 1189 | 72767 non-overloaded
200000 | 3 | 4801236 | 1.29 | 1762 | 173179
Comparing the overloaded with the non-overloaded
definition we obtain:
| overloaded | non-overloaded
-----------------+------------+---------------
1) GCs | high | low
depends on n | yes | no
2) alloc | high | low
3) user | high | low
4) mx | low | high
depends on n | no | yes
5) id | low | high
My questions:
1. Why do the two functions (with and without
type signature) show opposite behaviour?
2. Why do alloc and mx/id show opposite behaviour?
Marc Rehmsmeier.
-------------------------------------------------------------
GCs = number of garbage-collections (STAT-file)
alloc = bytes allocated from heap (STAT-file)
user = user time used (rusage)
mx = maximum resident set size (rusage)
id = integral resident set size (rusage)