For example
mov ax, [bp, - 2]
Takes from stack.
And
mov ax, word [some_Label]
Takes from heap.
I know that stack is much faster than heap because of the 1D'ish.
But using mov opcode as same method to take 2D'ish, doesn't it take the "speed from stack away"?
[Srry for bad english :)].
Edit:
Ok, so the text above is ancient can't believe I was so dumb, and still am XD.
So the question above meant to ask that: what is the difference between memory opcodes, that use the stack to load the data from, and those opcodes that use the heap to load the data from.
If I remember correctly what I meant by 1D'ish and 2D'ish was, that stack operates up and down, meanwhile heap has Page offset and a cell offset. This however is not true and I was wrong.
Answer:
Heap is slower at allocation time, because you need to ususally to call the kernel to give you the requested amount of memory (or if the user uses a smart allocator to allocate the wanted memory, then probrably the allocator already has already allocated a big memory buffer to give the user the memory from (this again is somewhat slower than stack allocation but atleast little faster than straight kernel level memory allocation requests.)) meanwhile stack allocation is just a substraction of stack register offset (RSP in x86_64). Thus allocating stack memory is faster than heap. But using mov operator to move data in/out from a heap/stack memory is the same speed.