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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 12CA8BB84 for ; Sun, 21 Sep 2008 22:02:28 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoUDAJ5E1kjAXQImiGdsb2JhbACSXz4BAQEVIpsQhWkBAoN8 X-IronPort-AV: E=Sophos;i="4.32,441,1217800800"; d="scan'208";a="29429726" Received: from discorde.inria.fr ([192.93.2.38]) by mail4-smtp-sop.national.inria.fr with ESMTP; 21 Sep 2008 22:02:27 +0200 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m8LK2RM6022986 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sun, 21 Sep 2008 22:02:27 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkgBANpE1kjRVcbtjmdsb2JhbACSXz4BAQEBCQkMBw8FmwOFaQECg3w X-IronPort-AV: E=Sophos;i="4.32,441,1217800800"; d="scan'208";a="17194204" Received: from rv-out-0506.google.com ([209.85.198.237]) by mail3-smtp-sop.national.inria.fr with ESMTP; 21 Sep 2008 22:02:26 +0200 Received: by rv-out-0506.google.com with SMTP id k40so1052821rvb.57 for ; Sun, 21 Sep 2008 13:02:25 -0700 (PDT) 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:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=EL2SyNA46+GSJOBlALSibB81FtXYd4g2nM1PG3jrUUI=; b=KsRDzeNnC9SArWu9BdHiD7csvIGwIQEr9TrYz866pUab0gtrZ9MkbyHpXucOVt584l kEOZRLMXt6vzUvgdRDE4GG7yEMcUPb75HXHhlsCXWpO0XFcCxflD1/vz/xg9rd89/TIz V99SPQGoEOMxWBL91WVOQUOhYD70WBYl0KCMc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=kBcWA5JpSbozXCDxtko93OHWyaO8ghaxkJftb0b5fDjmzXMNUY/lZdBkfARjy4xP9u +76rms+EaPPMj5Xo/B+sU3BXOA0H0yuTCeyEn84vRgHw7HeyXMcf6wpcw2iz0GBHPTVm xOK/NlcdPKT7AwBK51lwCwLJMYpSfK3V0O9Kg= Received: by 10.142.171.6 with SMTP id t6mr1038098wfe.209.1222027345297; Sun, 21 Sep 2008 13:02:25 -0700 (PDT) Received: by 10.142.240.21 with HTTP; Sun, 21 Sep 2008 13:02:25 -0700 (PDT) Message-ID: <700d600f0809211302o3a0ff2aau917c3d50b6b3055a@mail.gmail.com> Date: Sun, 21 Sep 2008 23:02:25 +0300 From: "Janne Hellsten" To: malc Subject: Re: [Caml-list] Portable PNG exporter Cc: caml-list@inria.fr In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <700d600f0809201037x3358a788v818d488c451ce7bf@mail.gmail.com> X-Miltered: at discorde with ID 48D6A853.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 nativeint:01 printf:01 fprintf:01 wrote:01 rewrite:01 ints:01 caml-list:01 imperative:01 int:01 int:01 functional:02 output:02 output:02 string:02 > Few things that hurt the eye: > > Int32.of_string "[number]" is unnecessary, OCaml(not sure which version > this was introduced in though) can read various specific size ints > natively: > > # 0n, 0l, 0L;; > - : nativeint * int32 * int64 = (0n, 0l, 0L) Thanks, I didn't know about this. I'm glad to learn there's a better way to do this. > Secondly `Printf.fprintf chnl "string"' looks rather expensive compared > to `output_string chnl "string"'. Speed wasn't one of my concerns when I wrote this. The temporary lists that are created per pixel are going to be hurt perf much more than those printfs. I changed the code nevertheless to use output_string. Replacing the functional style of accumulating CRC and Adler to use imperative style would allow for a clean rewrite that would be much faster. Janne