Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] c is 4 times faster than ocaml?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jack Andrews <effbiae@i...>
Subject: Re: [Caml-list] custom mmap modeled on bigarray
i know the argument for developing first, optimizing later.  i also know
the arguments for not caring about fine-grain performance and to look
at the big picture.  i've argued both and seen where these arguments fail.

consider compressed data as a bit stream from disk.
say it has simple encoding:
 phrase :=
  byte:<number-of-bits>, byte:<number-of-values>, int[]:<bit-stream>
  0x03 0x0a 0b1110 0011 1001 0100   1110 0101 1101 1100
  |    |    +<bit-stream>
  |    +number-of-values

represents the sequence of 10 3-bit numbers:


now consider a sentence as
  sentence := <empty> | phrase, sentence

without an enhanced FFI, ocaml will be considerably slower than C for
uncompressing (and compressing).

in my previous post, i suggest that some language primitives similar to
%bigarray_ref_1 could be introduced to make ocaml comparable to C.  i
have investigated this possibility, and my suggestion is that
%bigarray_ref is replaced by a primitive %ffi_ref and made public.
then bigarray can be built on the more general %ffi_ref and developers
have a fast means of accessing C arrays like mmap regions.

if i spend time implementing %ffi_ref/set, is there any chance of it being
incorporated into ocaml?



To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: