home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / function / 1380 < prev    next >
Encoding:
Text File  |  1992-11-17  |  1.9 KB  |  63 lines

  1. Newsgroups: comp.lang.functional
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!Sirius.dfn.de!news.uni-bielefeld.de!techfak.uni-bielefeld.de!marc
  3. From: marc@techfak.uni-bielefeld.de (Marc Rehmsmeier)
  4. Subject: CONTRAINDICATIONS
  5. Sender: news@hermes.hrz.uni-bielefeld.de (News Administrator)
  6. Message-ID: <Bxv6xI.Lq1@hermes.hrz.uni-bielefeld.de>
  7. Date: Tue, 17 Nov 1992 14:29:42 GMT
  8. Nntp-Posting-Host: schilf.techfak.uni-bielefeld.de
  9. Organization: Universitaet Bielefeld, Technische Fakultaet.
  10. Lines: 51
  11.  
  12.  
  13. Consider the following Haskell-definitions (maybe you recognize it =>
  14. "Is efficient backtracking feasible in functional languages?"):
  15.  
  16. strangesucc :: Int -> Int
  17. strangesucc n = head [x | x <- [0..], x > n]
  18.  
  19.  
  20. Evaluating main = print (strangesucc n)
  21. we obtain the following table:
  22.  
  23. n      | GCs | alloc    | user | mx   | id     
  24. -------+-----+----------+------+------+-------
  25. 100000 | 30  |  6001368 | 1.25 |  240 |  29927   overloaded 
  26. 200000 | 61  | 12001368 | 2.42 |  242 |  59174 
  27.  
  28. 100000 |  3  |  2401236 | 0.81 | 1189 |  72767   non-overloaded
  29. 200000 |  3  |  4801236 | 1.29 | 1762 | 173179 
  30.  
  31.  
  32. Comparing the overloaded with the non-overloaded
  33. definition we obtain:
  34.  
  35.                  | overloaded | non-overloaded
  36. -----------------+------------+---------------
  37.  1) GCs          | high       | low
  38.     depends on n | yes        | no
  39.  2) alloc        | high       | low
  40.  3) user         | high       | low
  41.  4) mx           | low        | high
  42.     depends on n | no         | yes
  43.  5) id           | low        | high
  44.  
  45.  
  46. My questions:
  47.  
  48. 1. Why do the two functions (with and without
  49.    type signature) show opposite behaviour?
  50.  
  51. 2. Why do alloc and mx/id show opposite behaviour?
  52.  
  53.  
  54. Marc Rehmsmeier.
  55.  
  56. -------------------------------------------------------------
  57.  
  58. GCs   = number of garbage-collections (STAT-file)
  59. alloc = bytes allocated from heap (STAT-file)
  60. user  = user time used (rusage)
  61. mx    = maximum resident set size (rusage)
  62. id    = integral resident set size (rusage)
  63.