🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.functional
Article #921

CONTRAINDICATIONS

#921
From: Marc Rehmsmeier
Date: Tue, 17 Nov 1992 14:29
51 lines
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)
Technical Details
Message-ID: <Bxv6xI.Lq1@hermes.hrz.uni-bielefeld.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!Sirius.dfn.de!news.uni-bielefeld.de!techfak.uni-bielefeld.de!marc

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.functional
Path: arc1-ca.pugleaf.net!sparky!uunet!haven.umd.edu!darwin.sura.net!Sirius.dfn.de!news.uni-bielefeld.de!techfak.uni-bielefeld.de!marc
From: marc@techfak.uni-bielefeld.de (Marc Rehmsmeier)
Subject: CONTRAINDICATIONS
Sender: news@hermes.hrz.uni-bielefeld.de (News Administrator)
Message-ID: <Bxv6xI.Lq1@hermes.hrz.uni-bielefeld.de>
Date: Tue, 17 Nov 1992 14:29:42 GMT
Nntp-Posting-Host: schilf.techfak.uni-bielefeld.de
Organization: Universitaet Bielefeld, Technische Fakultaet.
Lines: 51