[racket-dev] can we write these four lines of C in performant racket?

From: John Clements (clements at brinckerhoff.org)
Date: Sat Jul 23 14:42:15 EDT 2011

This C code adds the content of one buffer to another one, with no checking.  The corresponding racket code runs about 10x slower. Do you folks think that it should be possible to do better? (One salient fact: these are shorts--16-bit-ints--not 32-bit ints.)

John



void addOn(short *dst, int dstOffset, short *src, int srcOffset, int len) {
  int i;
  for (i = 0; i<len; i++) {
    dst[i+dstOffset] += src[i+srcOffset];
  }}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4624 bytes
Desc: not available
URL: <http://lists.racket-lang.org/dev/archive/attachments/20110723/108a0751/attachment.p7s>

Posted on the dev mailing list.