On 9/24/13 9:58 AM, Peter Alexander wrote:
On Tuesday, 24 September 2013 at 15:25:11 UTC, Andrei Alexandrescu wrote:
What are they paying exactly? An extra arg to allocate that can probably
be defaulted?
  void[] allocate(size_t bytes, size_t align = this.alignment) shared;

For allocating relatively small objects (say up to 32K), we're looking
at tens of cycles, no more. An extra argument needs to be passed
around and more importantly looked at and acted upon. At this level
it's a serious dent in the time budget.

The cost of a few cycles really doesn't matter for memory allocation...
If you are really allocating memory so frequently that those few extra
cycles matter then you are probably going to be memory bound anyway.

It does. I'm not even going to argue this.

I think this is a situation where you need to justify yourself with
something concrete. Can you provide an example of some code whose
performance is significantly impacted by the addition of an alignment
parameter? It has to be "real code" that does something useful, not just
a loop the continually calls allocate.

Strings.


Andrei

Reply via email to