| >> Any thumb rule for using arrays? I'm expecting access to be | >> O(1), it is right? | | > In GHC, yes. | | (Shouldn't this really be required? I mean, the whole *point* of using | arrays is to have O(1) random access, isn't it?)
In Hugs, no. In an ideal world, the answer would be yes, but the internal data structures that Hugs uses make it difficult to support variable size structures. So everything is coded up in terms of pairs. (Read the Gofer implementation report for more details and insight.) There was a time when Hugs included support for O(1) random access by allocating arrays in a separate heap (called the `flat resource' for any Hugs historians out there). But that code was removed in preparation for the grand merger of Hugs and GHC (at which point Hugs was to have inherited the runtime system of GHC, complete with flat arrays). But alas, that project faltered, the integrated system never made it past a "thrill-seekers" release, and Hugs today is without O(1) access to array components. For most purposes, and in the context of an interpreter, it really shouldn't matter too much; if you're looking for meaningful performance measurements, then you should really be using a compiler that doesn't incur the interpretive overhead of Hugs. | Can we also rely on destructive updates for the monadic arrays? On this point, in Hugs, I believe the answer is yes. All the best, Mark _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe