dip1000 and preview in combine to cause extra safety errors
forkit
forkit at gmail.com
Tue Jun 14 04:24:11 UTC 2022
On Tuesday, 14 June 2022 at 02:35:22 UTC, rikki cattermole wrote:
> All heap memory allocations are expensive.
>
> I cannot emphasize this enough.
>
> Stack allocation costs one instruction, an add. That's it. Heap
> allocation cannot compete.
ok. just in terms of 'allocation', for an int, for example:
https://d.godbolt.org/z/Y6E668hEn
it's a difference of 4 instructions (with stack having the lesser
amount)
then the question I have is, how much faster does it take for
*my* cpu to do those 6 instructions, vs those 10 instructions.
that seems difficult to accurately determine - as a constant ;-)
So I presume the assertion that stack 'allocation' is faster than
heap 'allocation', is based purely on the basis that there are 'a
few less' instructions involved in stack allocation.
More information about the Digitalmars-d
mailing list