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=1.4 required=5.0 tests=SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 50180BC6C for ; Wed, 6 Feb 2008 21:29:07 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAFqnqUdA6aaxi2dsb2JhbACQMgEBAQgEBAkKEQWWRoYf X-IronPort-AV: E=Sophos;i="4.25,313,1199660400"; d="scan'208";a="22312893" Received: from py-out-1112.google.com ([64.233.166.177]) by mail4-smtp-sop.national.inria.fr with ESMTP; 06 Feb 2008 21:29:07 +0100 Received: by py-out-1112.google.com with SMTP id v53so3627359pyh.33 for ; Wed, 06 Feb 2008 12:29:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=xEwxWoexNybPia8hMSYxg3J+TO2LijZk860P5e5MRfo=; b=Z5Y5O86kSs/0u1vHftGsVpWMqMTP47ACyI87T7Y6JzyoAvZFx9GACteP0R7uT8UclyUVEhx5Gq9eI236GH4dDsOa2r6j95NOE7DtcuoJEQu/Dda1RjtrMJRGcLcXbpr7HtaPfXNP1dErFpsEtqdhAJPLbQpzV1N7ZAaNKEEYjo8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=LOpKoUaDDHKa9oSXLZrrPkg1eBY2ddzgO751bhuk/S65VezPmXB1O8hPXE0pdAMy4rN1YmNJIBkKLpNDV4bOX4HJ9LIdzxyl5XTbYIWtykU3zj+NL8DXTKd+Rp7BeXD60uZhu1Qj96YpkctPdm6cUGUvnOuxvlCNW0qX+wZTRts= Received: by 10.35.111.14 with SMTP id o14mr11433438pym.24.1202329745596; Wed, 06 Feb 2008 12:29:05 -0800 (PST) Received: by 10.35.98.17 with HTTP; Wed, 6 Feb 2008 12:29:05 -0800 (PST) Message-ID: <854c25eb0802061229o34a6155dncca9d8492cfe6932@mail.gmail.com> Date: Wed, 6 Feb 2008 22:29:05 +0200 From: "Ilmari Heikkinen" To: caml-list@yquem.inria.fr Subject: OCaml image blending performance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Spam: no; 0.00; ocaml:01 ocaml:01 compiler:01 tarball:01 wget:01 wrote:01 computation:01 tar:01 tar:01 caml:02 sys:03 sys:03 optimizing:03 blending:05 blending:05 Hi, I was writing some image blending operations to get to grips with OCaml, and wrote the same code in C as well. Asking (and receiving) advice for optimizing the code on freenode #ocaml, I was told to post the code here as it might be an interesting compiler test. The C and Caml versions don't produce the same results, but should have the same amount of computation (don't take my word for it though, I don't know why the results differ.) The source files are: http://glimr.rubyforge.org/cake/blend.ml http://glimr.rubyforge.org/cake/blend2.ml http://glimr.rubyforge.org/cake/blend.c Or as a tarball: wget http://glimr.rubyforge.org/cake/blend_test.tar.gz tar zxf blend_test.tar.gz cd blend_test ./build.sh cblend real 0m1.466s user 0m1.456s sys 0m0.008s blend real 0m5.463s user 0m5.456s sys 0m0.012s blend2 real 0m3.423s user 0m3.404s sys 0m0.012s Use them as you wish. -- Ilmari Heikkinen