caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Jeff Henrikson" <jehenrik@yahoo.com>
To: "Chris Hecker" <checker@d6.com>
Cc: <caml-list@inria.fr>, "Berke Durak" <berke@altern.org>
Subject: RE: [Caml-list] Some suggested improvements to the Graphics and Bigarray modules
Date: Wed, 10 Oct 2001 15:47:40 -0400	[thread overview]
Message-ID: <003c01c151c4$6ba686c0$0b01a8c0@mit.edu> (raw)
In-Reply-To: <4.3.2.7.2.20011010000348.03039ba0@arda.pair.com>

> >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


  reply	other threads:[~2001-10-10 19:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-09 21:31 Berke Durak
2001-10-09 23:21 ` [Caml-list] " Christopher Quinn
2001-10-10  0:52 ` [Caml-list] " Jeff Henrikson
2001-10-10  7:04   ` Chris Hecker
2001-10-10 19:47     ` Jeff Henrikson [this message]
2001-10-11  0:50       ` John Prevost
2001-10-12 14:29 ` Jun P. FURUSE
2001-10-12 15:02 ` Xavier Leroy
2001-10-12 15:38   ` Berke Durak
2001-10-12 17:15     ` Daniel de Rauglaudre
2001-10-13 23:16       ` Berke Durak
2001-10-14  3:14         ` Daniel de Rauglaudre

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='003c01c151c4$6ba686c0$0b01a8c0@mit.edu' \
    --to=jehenrik@yahoo.com \
    --cc=berke@altern.org \
    --cc=caml-list@inria.fr \
    --cc=checker@d6.com \
    /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;
as well as URLs for NNTP newsgroup(s).