Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Some suggested improvements to the Graphics and Bigarray modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jeff Henrikson <jehenrik@y...>
Subject: RE: [Caml-list] Some suggested improvements to the Graphics and Bigarray modules
> >I also wrote one C function to do a special case of alpha composting bigarrays together in ARGB format.
>
> Did you try writing this in caml?  I'd think you could get pretty close, speedwise, and it'd be interesting to find out.

No, I didn't try.  I would have had I felt it was easier to get correct on caml, but frankly, the code is so small that I didn't
feel it was an advantage.

Besides, C is pretty darn expressive when all you are doing is pushing bits.  I still can't remember all the lsl lsr asr lor
operations, (along with their fixity and precidence convention) by memory.  And never mind that those names are all renamed
randomly for int32s.  They are made prefix rather than infix and the convention of the word "logical" is reversed:

lsl (the l is for "logical")  left_shift
lsr (the l is for "logical")  right_shift_logical
asr (the a is for "arithmetic"?) shift_right
lor                              logor

On the other hand I can remember >> << ~ | and &.

Also, I find the caml for loop's lack of functionality annoying.  I really should learn camlp4 so I can write a real C-style for
loop.  (with break and continue, though it's not pertinent here.)  Somebody doesn't have such things convieniently lying around do
they?

On performance, the conventional encoding of alpha uses all 8 bits.  Since caml ints are only 31 bits, this means using int32s.
Though I keep hearing stuff about int32s not being that slow, I have a hard time believing just from a machine op count point of
view that using int32s could really compete in such an innermost loop as a pixel operation.

The caml int32 vs C benchmark would be interesting, but I'm not sure interesting enough to overcome my threshold of laziness for me
to go back and rewrite something that works.

Oh, and then there's also the bytecode/asmcode interoperability problem, which is another vote for C.


Jeff Henrikson




> -----Original Message-----
> From: Chris Hecker [mailto:checker@d6.com]
> Sent: Wednesday, October 10, 2001 3:05 AM
> To: Jeff Henrikson; Berke Durak
> Cc: caml-list@inria.fr
> Subject: RE: [Caml-list] Some suggested improvements to the Graphics and
> Bigarray modules
>
>
>
> >I also wrote one C function to do a special case of alpha composting bigarrays together in ARGB format.
>
> Did you try writing this in caml?  I'd think you could get pretty close, speedwise, and it'd be interesting to find out.
>
> Chris
>

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr