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=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 1FF29BC6C for ; Thu, 7 Feb 2008 16:08:40 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aj0KABeuqkfUnw7XbGdsb2JhbACCN416CwQGBwkZm1g X-IronPort-AV: E=Sophos;i="4.25,316,1199660400"; d="scan'208";a="8917794" Received: from fhw-relay07.plus.net ([212.159.14.215]) by mail3-smtp-sop.national.inria.fr with ESMTP; 07 Feb 2008 16:08:39 +0100 Received: from [80.229.56.224] (helo=beast.local) by fhw-relay07.plus.net with esmtp (Exim) id 1JN8Mg-0008PR-Qf for caml-list@yquem.inria.fr; Thu, 07 Feb 2008 15:08:38 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] OCaml image blending performance Date: Thu, 7 Feb 2008 15:04:24 +0000 User-Agent: KMail/1.9.7 References: <854c25eb0802061229o34a6155dncca9d8492cfe6932@mail.gmail.com> <200802062334.02485.jon@ffconsultancy.com> <20080207110154.GA24561@annexia.org> In-Reply-To: <20080207110154.GA24561@annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200802071504.24169.jon@ffconsultancy.com> X-Plusnet-Relay: a8d960fbfbb963d8faa1b3a4542fd629 X-Spam: no; 0.00; ocaml:01 inlining:01 ml':01 ocaml:01 byte:01 ocaml's:01 integers:01 integers:01 ocamlopt:01 frog:98 wrote:01 wrote:01 inline:01 caml-list:01 functions:01 On Thursday 07 February 2008 11:01:54 Richard Jones wrote: > On Wed, Feb 06, 2008 at 11:34:02PM +0000, Jon Harrop wrote: > > In this case, most of the speed loss can be regained by simply > > aggressively inlining everything, which is exactly what you (ab)used > > C macros for in the C code. > > I don't understand this. In 'blend2.ml' (which I was responsible for) > C macros are used to inline all the OCaml functions the same as in the > C version. Yet it's still 70% slower than the C version. > > My suspicion was that it was to do with his use of a string as a byte > array. I suspect OCaml's 31-bit integers are responsible for the remaining slowdown. You might try using 32-bit integers (Int32) but I'm not sure ocamlopt will unbox them as aggressively as it does floats (I've never tried it). -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/?e