From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id DBD34BC69 for ; Sat, 21 Oct 2006 09:25:26 +0200 (CEST) Received: from pih-relay05.plus.net (pih-relay05.plus.net [212.159.14.132]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id k9L7PQuZ006171 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Sat, 21 Oct 2006 09:25:26 +0200 Received: from [80.229.56.224] (helo=[10.0.0.5]) by pih-relay05.plus.net with esmtp (Exim) id 1GbBET-0005wn-Ra for caml-list@inria.fr; Sat, 21 Oct 2006 08:25:25 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@inria.fr Subject: Re: [Caml-list] record field access Date: Sat, 21 Oct 2006 08:23:39 +0100 User-Agent: KMail/1.9.4 References: <20061021035358.GB15596@malaquias.gwiceb1> In-Reply-To: <20061021035358.GB15596@malaquias.gwiceb1> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200610210823.39902.jon@ffconsultancy.com> X-Miltered: at discorde with ID 4539CB66.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; romildo:01 sqrt:01 unboxed:01 optimise:01 indirection:01 ocaml:01 frog:98 wrote:01 caml-list:01 avoids:01 tuples:01 tuples:01 caml:02 objective:02 let:03 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