[racket] Is struct allocation really more expensive than vector allocation?

From: Alexis King (lexi.lambda at gmail.com)
Date: Wed Jan 14 15:09:39 EST 2015

When using the optimization coach, it sometimes gives me this message:

> This struct constructor is used in hot code. Allocating structs is expensive, consider using vectors instead. To keep the same interface, consider defining macro wrappers around the vector operations that have the same name as the struct constructor and accessors.


Is this really all that accurate? In some simple tests I’ve done, I haven’t found struct allocation to be any more expensive than vector allocation of equivalent size. What are the situations in which this holds to be true?

Posted on the users mailing list.