Re: Fragmented arrays?

John Reppy <[email protected]> Tue, 19 Jan 2010 10:55:05 -0600
Newsgroups gmane.comp.lang.sml.smlnj
Message-ID <[email protected]>
I'm not sure what you are getting at.  Arrays support update in place, so at the machine-level, the
update operation is just a store instruction (plus any write-barrier overhead required by the GC).

	- John

On Jan 17, 2010, at 5:41 AM, Jon Loldrup wrote:

> I read that the basis library Array structure has constant time access and update*.
> If an array of length n has to be able to be updated in constant time (that is, invariant from the length of the array), I can only see that it can be done if arrays are allowed to be fragmented across memory, like lists are. No piece of memory must be overwritten/forgotten (except by the garbage collector), so you will have to write the updated cell in a new place. If you write all of the array again, you loose constant time, and if you don't, you get a fragmented array.
> Can anyone confirm that this is the way constant time update is achieved?
> I have to update my array one cell at a time. Won't this lead to severe fragmentation, hurting performance?
> 
> kind regards Jon Loldrup
> * "The Standard ML basis library" p. 112
> ------------------------------------------------------------------------------
> Throughout its 18-year history, RSA Conference consistently attracts the
> world's best and brightest in the field, creating opportunities for Conference
> attendees to learn about information security's most important issues through
> interactions with peers, luminaries and emerging and established companies.
> http://p.sf.net/sfu/rsaconf-dev2dev_______________________________________________
> Smlnj-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/smlnj-list


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev