Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Efficiency of 'a list
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Eray Ozkural <exa@k...>
Subject: Re: [Caml-list] Efficiency of 'a list
On Sunday 04 May 2003 07:08, alc@PublicPropertySoftware.com wrote:
> I've done a little timing of things, and according to my results:
> If you care about efficiency and use OCaml, you should use lists
> fairly often, ie if you are always looping and accessing the elements
> in order. OCaml can iterate through a list (recursively) about twice as
> fast as it can iterate through an array.  It can iterate through a
> list about as fast as or maybe even a little faster than C or C++ can
> iterate through an array.

Considering n appends and m iterations.

I must point out that this is non-sense. An open table like my Dynarray module 
will be a lot faster than a list because of two things:
1) cache coherence (more important)
2) reduced page faults (TLB misses, important after context switches)


-- 
Eray Ozkural (exa) <erayo@cs.bilkent.edu.tr>
Comp. Sci. Dept., Bilkent University, Ankara  KDE Project: http://www.kde.org
www: http://www.cs.bilkent.edu.tr/~erayo  Malfunction: http://mp3.com/ariza
GPG public key fingerprint: 360C 852F 88B0 A745 F31B  EA0F 7C07 AE16 874D 539C

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners