[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2007-04-10 (00:13) |
From: | David Baelde <david.baelde@g...> |
Subject: | Re: Optimizing Array.blit |
Hi again, To answer the question by myself, I have ran a few tests. It turned out that specializing Array.blit provides a significant boost, but doing such an ugly hack was dangerous and unnecessary. I now use the following standard code: CAMLprim value caml_float_array_blit(value _src, value _src_off, value _dst, value _dst_off, value _len) { int src_off = Int_val(_src_off) ; int dst_off = Int_val(_dst_off) ; int len = Int_val(_len) ; int i ; for (i=0 ; i<len ; i++) Store_double_field(_dst,dst_off+i,Double_field(_src,src_off+i)) ; return Val_unit ; } I got the following timings in seconds for a program doing intensive blits on float arrays: 0.17 for the ugly hack, 0.19 for the clean C function, 1.04 for the standard Array.blit. -- David