Fragmented arrays?
Jon Loldrup <[email protected]> Sun, 17 Jan 2010 12:41:33 +0100
| Newsgroups | gmane.comp.lang.sml.smlnj |
|---|---|
| Message-ID | <[email protected]> |
--===============4747803661380308534== Content-Type: multipart/alternative; boundary=00032555e42e1dfd3c047d5ab903 --00032555e42e1dfd3c047d5ab903 Content-Type: text/plain; charset=ISO-8859-1 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 --00032555e42e1dfd3c047d5ab903 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I read that the basis library Array structure has constant time access and = update*.<br>If an array of length n has to be able to be updated in constan= t time (that is, invariant from the length of the array), I can only see th= at it can be done if arrays are allowed to be fragmented across memory, lik= e lists are. No piece of memory must be overwritten/forgotten (except by th= e garbage collector), so you will have to write the updated cell in a new p= lace. If you write all of the array again, you loose constant time, and if = you don't, you get a fragmented array.<br> Can anyone confirm that this is the way constant time update is achieved?<b= r>I have to update my array one cell at a time. Won't this lead to seve= re fragmentation, hurting performance?<br><br clear=3D"all">kind regards Jo= n Loldrup<br> * "The Standard ML basis library" p. 112<br> --00032555e42e1dfd3c047d5ab903-- --===============4747803661380308534== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ 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 --===============4747803661380308534== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Smlnj-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/smlnj-list --===============4747803661380308534==--