chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Optimizing inner loops


From: Carlos Pita
Subject: Re: [Chicken-users] Optimizing inner loops
Date: Tue, 29 Aug 2006 16:37:22 -0300 (ART)

> ((foreign-lambda* void ((int n) (f64vector a)
> (f64vector b)  
> (f64vector c))
> "
> int i;
> for (i = 0; i < n; i++) {
>       a[i] = b[i] + c[i];
> }
> ")
>   (f64vector-length a) a b c)

> 2. it won't work  
> in interpreted code.  I've been wanting to improve
> on this for some  
> time.  At some point, I'll get some spare time and
> whip up a nice  
> macro which uses (eval-when ...) to output the above
> at compile time,  
> and uses the native scheme math operators when
> interpreted. 

Mhh, sounds more than enough for my purposes. Perhaps
what you've been wanting or something pretty similar
is already done. Do you know the inline egg?:

http://www.call-with-current-continuation.org/eggs/inline.html

For example:

  ==> (inline:compile "int foo(int n) { return(n * 2);
}") ; when interpreted
  ==> (declare                                        
    ; when compiled
        (foreign-declare "int foo(int n) { return(n *
2); }")
        (foreign-parse "int foo(int n) { return(n *
2); }") )

Regards,
Carlos


        
        
                
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]