Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Janne Hellsten" <jjhellst@gmail.com>
To: malc <av1474@comtv.ru>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Portable PNG exporter
Date: Sun, 21 Sep 2008 23:02:25 +0300	[thread overview]
Message-ID: <700d600f0809211302o3a0ff2aau917c3d50b6b3055a@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0809212346400.2322@linmac.oyster.ru>

> 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


      reply	other threads:[~2008-09-21 20:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-20 17:37 Janne Hellsten
2008-09-20 23:03 ` [Caml-list] " Richard Jones
2008-09-22 14:47   ` Florent Monnier
2008-09-22 14:59   ` Janne Hellsten
2008-09-22 15:56     ` Daniel Bünzli
2008-09-21  0:47 ` Jon Harrop
2008-09-21 19:50 ` malc
2008-09-21 20:02   ` Janne Hellsten [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=700d600f0809211302o3a0ff2aau917c3d50b6b3055a@mail.gmail.com \
    --to=jjhellst@gmail.com \
    --cc=av1474@comtv.ru \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox