On Tue, Jul 27, 2004 at 10:04:34AM +0200, Falk Hueffner wrote:
> Well, for example on Alpha, String.length is:
> ldq t6,-8(a0)
> lda t7,1
> srl t6,0xa,t5
> s8subq t5,t7,t4
> addq a0,t4,t3
> lda at,0(t3)
> ldq_u t2,0(at)
> extbl t2,at,t2
> subq t4,t2,t1
> addq t1,t1,t0
> addq t0,0x1,v0
>
> while type t = { len: int; data: string };; let f x = x.len is
>
> ldq v0,0(a0)
Don't forget that storing the extra int isn't free either. It
increases pressure on the cache, particularly for programs which store
many short strings. However because it is much less easy to measure,
memory pressure is often wrongly ignored.
Rich.
--
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
MOD_CAML lets you run type-safe Objective CAML programs inside the Apache
webserver. http://www.merjis.com/developers/mod_caml/
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
|