Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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
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