[racket] TR memory optimization: 240 Bytes of garbage for calling TR?

From: John Clements (clements at brinckerhoff.org)
Date: Sat Nov 10 23:04:37 EST 2012

On Nov 10, 2012, at 12:30 PM, Neil Toronto wrote:

> On 11/10/2012 08:22 AM, John Clements wrote:
>> (: comb1 (Float -> Float))
>> (define (comb1 in)
>>   (define delayed1 (flvector-ref v1 c1))
>>   (define midnode1 (fl+ delayed1 (fl* g11 m1)))
>>   (define out1 (fl+ (fl* g21 midnode1) in))
>>   (flvector-set! v1 c1 out1)
>>   (define next-c1 (add1 c1))
>>   (set! c1 (cond [(<= d1 next-c1) 0]
>>                  [else next-c1]))
>>   (set! m1 midnode1)
>>   out1)
>> 
>> I can't see anything in this that would cause allocation.
> 
> I'll bet `set!' does it. Also, if `comb1' doesn't get inlined at its application sites, I think `in' and `out1' will get boxed.

I thought that might be the problem, and changed my set!'s into flvector-set!s, but didn't observe any change.

John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4370 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20121110/8e363983/attachment.p7s>

Posted on the users mailing list.