Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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, 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) <>
Comp. Sci. Dept., Bilkent University, Ankara  KDE Project:
www:  Malfunction:
GPG public key fingerprint: 360C 852F 88B0 A745 F31B  EA0F 7C07 AE16 874D 539C

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: