[plt-scheme] Fast Byte Vector Traversal (200MB+ file)
Some time ago I tested matrix multiplication using Scheme vectors,
f64vectors, and C code. The C code was something like 100x faster.
Using vectors was about 5x faster than f64vectors IIRC. Things have
changed since then, but I expect the general result is the same. For
more complex code the difference is less, as things like jumps,
fetches, etc. take up more of the time. For this simple kind of code C
is just so much closer to the machine model that Scheme can't compete.
I have had good results with the following:
> 3) Write a small C library, and use FFI. Will contracts slow it down?
Contracts shouldn't slow things down too much, as long as your C
library does enough work that the FFI / contract overhead is a small
part of its runtime cost. I.e. don't call a C function that only does
a few instructions worth of work.
HTH,
Noel