English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

Browse thread
Portable PNG exporter
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-09-21 (20:02)
From: Janne Hellsten <jjhellst@g...>
Subject: Re: [Caml-list] Portable PNG exporter
> 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

Replacing the functional style of accumulating CRC and Adler to use
imperative style would allow for a clean rewrite that would be much