Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is 'absolute' faster than Move()?

Tags:

delphi

For example,We have a DWORD = $12345678

Which of the instructions would be faster - absolute or Move()?

var a:DWORD = $12345678;
    b:Array[0..3] of byte absolute a;


var a:DWORD = $12345678;b:Array[0..3] of Byte
begin
  Move(a,b,4);
end;

Specifically,I'm asking what exactly 'absolute' does,because if it doesn't use additional memory to write that byteArray then I have no reason to use Move instead of absolute in that case so how does 'absolute' work?

like image 470
Ivan Prodanov Avatar asked Jul 10 '09 09:07

Ivan Prodanov


2 Answers

absolute does not perform any operation; it declares the address of a var to be the same as another var.

Move() performs a copy operation, which takes some time.

With absolute, both vars are stored at the same address, your second declaration stores the vars at different locations.

like image 195
devio Avatar answered Sep 21 '22 10:09

devio


The 'absolute' directive points to the same memory as the specified variable. No code is executed, so yes it is faster than Move or any other code.

like image 29
Ondrej Kelle Avatar answered Sep 21 '22 10:09

Ondrej Kelle