Browse thread
[Caml-list] Efficiency of 'a list
-
Eray Ozkural
- Mattias Waldau
- Lauri Alanko
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Mattias Waldau <mattias.waldau@a...> |
| Subject: | [Caml-list] Two types of efficiency (Was Efficiency of 'a list) |
> alc@PublicPropertySoftware.com
> 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
We are talking about two kinds of efficiency:
1. Absolute speed for mostly small benchmarks
2. Scalable programs, i.e. they work fine for input of length 100,
but goes on forever for input of length 1000.
Scalability is the one that I am talking about, and is the one that
mostly gets bitten by inappropriate use of lists. For me scalability
is the most important.
If you use Map/Hash/Set small benchmarks will be slower, however your
programs are more likely to be scalable.
Languages like PHP have more advanced built-in datastructures with
language syntax to support them. In Ocaml, we can create the same
program, however, there is no syntax support, and we have to add
declarations like
module StringSet = Set.Make(struct
type t = string
let compare = compare
end) ;;
It would be nice if the typechecker could deduce the type of the set and
add the above declaration automatically to the program. That would make
it easier for beginners to use the advanced datastructures of Ocaml.
-------------------
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