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

From: Leif Andersen (leif at leifandersen.net)
Date: Wed Jan 14 16:24:29 EST 2015

I think it used to be a lot more expensive then it is now. The tests that
I've run finds structs to be (slightly) more expensive, although nothing
too major (depending on your definition of major.)

Here is one (admittedly very simple) tests that does show a difference (for
me anyway)).

https://github.com/LeifAndersen/experimental-methods-in-pl/tree/master/exp7

> In some simple tests I’ve done, I haven’t found struct allocation to be
any more expensive than vector allocation of equivalent size.

I'd be very interested in seeing these tests if they're available.


~Leif Andersen

On Wed, Jan 14, 2015 at 3:09 PM, Alexis King <lexi.lambda at gmail.com> wrote:

> 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?
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20150114/d92c4f10/attachment.html>

Posted on the users mailing list.