English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] removing an item from a list efficiently
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-11-07 (15:51)
From: Brian Hurt <bhurt@s...>
Subject: Re: [Caml-list] removing an item from a list efficiently
On Fri, 7 Nov 2003, Dustin Sallings wrote:

> 	I'm trying to implement an LRU cache and I'm using a list to keep up 
> with the accesses.  I'm using filter to remove the item for 
> repositioning it.  That's very slow.
> 	Is there a better way to efficiently move a list item to the front, or 
> should I just implement a linked list to meet my requirements?

If delete needs to be fast, consider using a different data structure.  
Look at the Set, Map, and Hashtbl libraries.


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