From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 6BA08BB91 for ; Thu, 13 Jan 2005 21:24:20 +0100 (CET) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.203]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j0DKOJJr002322 for ; Thu, 13 Jan 2005 21:24:20 +0100 Received: by wproxy.gmail.com with SMTP id 50so230241wri for ; Thu, 13 Jan 2005 12:24:19 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=p3vYfF7GGJc/++jdOS/u0w9U298MzJK/G5ihHVcIbe2yXzdoA3rA+cXmjcmIq7hb+IVXvI5IdVrkUEVZMdjTeJ5sPZAlgFnHCVXJo1EQaWzD+LsRZH5CGZ5HPcjLAqtuUw/0LKARGjZhxMOEVUP0S5bagrnnDGX+VKSbgdPnqis= Received: by 10.54.50.50 with SMTP id x50mr19674wrx; Thu, 13 Jan 2005 12:24:19 -0800 (PST) Received: by 10.54.22.70 with HTTP; Thu, 13 Jan 2005 12:24:19 -0800 (PST) Message-ID: Date: Thu, 13 Jan 2005 15:24:19 -0500 From: John Prevost Reply-To: John Prevost To: "Will M. Farr" Subject: Re: [Caml-list] Ocaml sums the harmonic series -- four ways, four benchmarks: floating point performance Cc: caml-list@yquem.inria.fr, shootout-list@lists.alioth.debian.org In-Reply-To: <850815AC-6595-11D9-A551-000393A34E82@mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <3D3A6BF5-657B-11D9-A551-000393A34E82@mit.edu> <850815AC-6595-11D9-A551-000393A34E82@mit.edu> X-Miltered: at nez-perce with ID 41E6D8F3.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; prevost:01 prevost:01 caml-list:01 ocaml:01 trivial:01 o'caml:01 allocating:01 heap:01 doubles:01 outs:98 ints:01 ints:01 normalize:01 int:01 int:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.0 X-Spam-Level: There quite possibly is--I could look. But I do believe that the Intel architecture is best optimized for at least some set of operations. For example, looking through the assembly source, you'll notice that it sometimes abuses Intel addressing modes to reduce the cost of "Caml ints are just like native ints with a 1 in the low bit". As for whether there's a quick "convert int to float" call in Intel, I really have no idea. The assembly for the simple function: let test x = float_of_int x isn't trivial, however. I have to admit that I don't know the ins and outs of Intel assembly any further than I have learned them while trying to optimize specific O'Caml loops. And since I rarely use floating point, all of these opcodes are greek to me. :) I *think* it's allocating space in the heap for the float, then filling it in with a non-normalized value (which is pretty easy, since doubles are 64 bits, and ints are 31 bits), and then saying "normalize this, please." But I can't say for sure. And since I don't have a PPC system to play with, I can't compare. John.