Version française
Home     About     Download     Resources     Contact us    
Browse thread
record field access
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] record field access
On Saturday 21 October 2006 04:53, j.romildo@gmail.com wrote:
> And to compare records with tuples, given also
>
>    let dist3 (x1,y1) (x2,y2) =
>       sqrt (sqr (x2 -. x1) +. sqr (y2 -. y1))
>
> what should be preferable: dist2 or dist3, regarding performance?

Specifically for all-float tuples and records, the internal representations 
are different, with all-float records being unboxed. The performance 
characteristics will be correspondingly different.

Otherwise, I don't know. I tried a lot of different combinations to try to 
optimise my ray_sphere routine in the ray tracer. I got the impression that 
it can affect register allocation, e.g. no CSE => pulling out {a.x=ax} in a 
pattern requires an extra register but avoids repeated indirection (ax vs 
a.x).

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists