With a c-lambda the procedure itself and the conversion functions have to be called, and this adds considerable overhead on such a tiny piece of code. A ##c-code has no overhead.
Marc
On Apr 26, 2020, at 7:14 PM, Lucier, Bradley J bradley.j.lucier.1@purdue.edu wrote:
On Apr 26, 2020, at 6:20 PM, Marc Feeley feeley@iro.umontreal.ca wrote:
(c-declare "#define ELEM0(u64vect) ___BODY_AS(u64vect,___tSUBTYPED)[0]")
(define-macro (u64-xor! v1 v2) ;; v1[0] = v1[0] ^ v2[0] `(##c-code "ELEM0(___ARG1) ^= ELEM0(___ARG2);" v1 v2))
He originally had similar code:
; (define u64c-and ; (c-lambda (unsigned-int64 unsigned-int64) ; unsigned-int64 "___return(___arg1 & ___arg2);”))
Would inlining the code as you did give better performance instead of using a c-lambda?
Brad