Browse thread
Scripting in ocaml
[
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: | 2006-12-22 (12:37) |
From: | Jon Harrop <jon@f...> |
Subject: | Re: [Caml-list] Scripting in ocaml |
On Thursday 21 December 2006 21:27, Philippe Wang wrote: > If you want to do that, use Lisp... Lisp is too slow. > Or use sum types... > type t = Int of int | Float of float | ... Manual boxing is too verbose. > OCaml forgets types at runtime! Some type related information is certainly retained, e.g. to unbox float arrays. > This means that you can't know without a huge cost (cf. SafeUnmarshal > costs), because what you can do in O(1) is to know whether a value is an > int or a pointer... I'd like to quantify this cost. I've read papers and heard work stating that carrying run-time type information can be cheap but I see evidence that might point to the contrary, e.g. F# is significantly slower than OCaml but it has concurrent GC that was designed for a non-FPL. In F#, you have run-time type information. Amongst other things, this allows you to dispatch to more efficient type-specialised functions. For example, you can write functions over polymorphic arrays and dispatch to optimised BLAS versions for float arrays when the input happens to be a float array. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. Objective CAML for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists