11 Apr 14:50
Re: c-wrapper: performance problem
From: KOGURO, Naoki <naoki <at> koguro.net>
Subject: Re: c-wrapper: performance problem
Newsgroups: gmane.lisp.scheme.gauche
Date: 2008-04-11 12:50:44 GMT
Subject: Re: c-wrapper: performance problem
Newsgroups: gmane.lisp.scheme.gauche
Date: 2008-04-11 12:50:44 GMT
Hi Jens, On 2008/04/11, at 3:52, Jens Thiele wrote: > I stumbled across a performance problem: > Converting some c byte array (char*) to a u8vector is really slow. It > semms the bytes are copied byte for byte in scheme. But maybe my > approach is just plain wrong? You're right, the cast method has not been optimized for uvector yet. If you want to use bulk copy, you can use memcpy as you do in C, such like the code below. (define buf (make-u8vector 100)) ;; ary is C byte array. (memcpy buf ary 100) An uvector is used in pointer context, the pointer of the uvector's storage is passed to C function. -- KOGURO, Naoki <naoki <at> koguro.net> ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
RSS Feed