dip1000 and preview in combine to cause extra safety errors

forkit forkit at gmail.com
Tue Jun 14 07:17:39 UTC 2022


On Tuesday, 14 June 2022 at 04:40:44 UTC, rikki cattermole wrote:
>
> No.
>
> The stack allocation uses a single mov instruction which is as 
> cheap as you can get in terms of instructions.
>
> You are comparing that against a function call which uses 
> linked lists, atomics, locks and syscalls. All of which are 
> pretty darn expensive individually let alone together.
>
> These two things are in very different categories of costs.
>
> One is practically free, the other is measurable.

how do I can explain this result in godbolt(using the -O 
paramater to ldc2):

https://d.godbolt.org/z/hhT8MPesv

if I understand the output correctly (and it's possible I don't), 
then it's telling me that there is no difference, in terms of the 
number of intructions needed, to allocate an int on the stack vs 
allocating it on the heap - no difference whatsoever. I don't get 
it.

Is the outcome perculiar to just this simple example?



More information about the Digitalmars-d mailing list