Browse thread
Efficiency of let/and
[
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: | Mackenzie Straight <eizneckam@g...> |
| Subject: | Re: Ant: [Caml-list] Efficiency of let/and |
On 9/26/05, Brian Hurt <bhurt@spnz.org> wrote:
> Syntactically and semantically there is no difference. I was wondering if
> the ocamlopt compiler took advatange of the implicit paralellism at all.
In any case, it makes (as far as I know) no difference which syntax you use:
% ocaml -drawlambda
Objective Caml version 3.08.3
# let foo a1 a2 = let l1 = Array.length a1 and l2 = Array.length a2 in l1+l2;;
(let
(foo/65
(function a1/66 a2/67
(let (l1/68 (array.length a1/66) l2/69 (array.length a2/67))
(+ l1/68 l2/69))))
(apply (field 1 (global Toploop!)) "foo" foo/65))
val foo : 'a array -> 'b array -> int = <fun>
# let bar a1 a2 = let l1 = Array.length a1 in let l2 = Array.length a2
in l1+l2;;
(let
(bar/70
(function a1/71 a2/72
(let (l1/73 (array.length a1/71) l2/74 (array.length a2/72))
(+ l1/73 l2/74))))
(apply (field 1 (global Toploop!)) "bar" bar/70))
val bar : 'a array -> 'b array -> int = <fun>