Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.haskell > #172
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Newsgroups | comp.lang.haskell |
| Subject | Re: arrays instead of lists |
| References | <4119f978-a247-4efa-93d1-af6d6ddcb5d9@b9g2000pbo.googlegroups.com> |
| Date | 2012-02-20 01:17 -0800 |
| Message-ID | <7xr4xp7tkc.fsf@ruckus.brouhaha.com> (permalink) |
| Organization | Nightsong/Fort GNOX |
Sean McIlroy <namenobodywants@gmail.com> writes: > how much more efficient is it to use (one-dimensional) arrays instead > of (long) lists? could it conceiveably make the difference between a > script that overflows the stack and one that doesn't? thanks if you > can help Stack overflow is usually caused by space leaks due to lazy evaluation letting unforced thunks pile up. It takes a while to develop a sense of where this is happening and put in annotations to prevent it. One easy measure is to compile with ghc -O2 and see if that helps (it does more automatic analysis of this issue). Once you have the space leaks out of the way, you shouldn't get stack overflow unless the program uses an awful lot of memory. Arrays can be faster than lists or intmaps, but it's best to think of them as a low-level optimization to pursue after you've gotten algorithmic issues out of the way.
Back to comp.lang.haskell | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
arrays instead of lists Sean McIlroy <namenobodywants@gmail.com> - 2012-02-20 00:49 -0800 Re: arrays instead of lists Paul Rubin <no.email@nospam.invalid> - 2012-02-20 01:17 -0800 Re: arrays instead of lists Dirk Thierbach <dthierbach@usenet.arcornews.de> - 2012-02-20 11:27 +0100
csiph-web