It turns out that it's always the first tested function that's slower. You can test this by switching benchA and benchB in the call to benchmark(). I suspect the reason is that the OS is paging in the code the first time, and we're actually seeing the cost of the page fault. If you a second round of benchmarks after the first one, that one shows more or less the same performance for both functions.
Re: Align a variable on the stack.
Marc Schütz via Digitalmars-d-learn Fri, 06 Nov 2015 03:41:00 -0800
Ok, benchA and benchB have the same assembler code generated.
However, I _can_ reproduce the slowdown albeit on average only
20%-40%, not a factor of 10.
- Re: Align a variable on the stack. Marc Schütz via Digitalmars-d-learn
- Re: Align a variable on the s... TheFlyingFiddle via Digitalmars-d-learn
- Re: Align a variable on the s... arGus via Digitalmars-d-learn
- Re: Align a variable on t... rsw0x via Digitalmars-d-learn
- Re: Align a variable on the s... steven kladitis via Digitalmars-d-learn
- Re: Align a variable on t... BBaz via Digitalmars-d-learn