Thread View: comp.lang.functional
1 messages
1 total messages
Started by Marc Rehmsmeier
Tue, 17 Nov 1992 14:29
CONTRAINDICATIONS
Author: Marc Rehmsmeier
Date: Tue, 17 Nov 1992 14:29
Date: Tue, 17 Nov 1992 14:29
51 lines
2040 bytes
2040 bytes
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)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads