Forum > Windows

Old MoveJOH_PAS_3 move memory more fast , even copymemory or zeromemory?

(1/1)

d2010:
Hello.
In few cases, I move memory (always move-memory fix 32characters fix exactly one point of project.lpr).
In that case, other user, say Must I replace copymemory with Move_i32, but
the program-developer must be 100% sure the size=32characters.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Procedure Move_i32(const ASource; var ADest; ACount: Integer);asm  mov ecx, [eax]  mov [edx], ecx             {4}  mov ecx, [eax + 4]  mov [edx + 4], ecx         {8}  mov ecx, [eax + 8]  mov [edx + 8], ecx         {12}  mov ecx, [eax + 12]  mov [edx + 12], ecx        {14}  mov ecx, [eax + 16]  mov [edx + 16], ecx        {16}  mov ecx, [eax + 20]  mov [edx + 20], ecx        {24}  mov ecx, [eax + 24]  mov [edx + 24], ecx        {24}  mov ecx, [eax + 28]  mov [edx + 28], ecx        {28}end; Example1: 


--- Code: ---Procedure Good10Solutionl
Var cnt:integer;
Begin //more fast
   for  cnt:= 1 to (01 shl 20) do Move_i32(srce,dest,32);
End;

Procedure Slow10Solution;
Var cnt:integer;
Begin
   for  cnt:= 1 to (01 shl 20) do copymemory(dest,srce,32);
End;

--- End code ---
C:Q1=Can I use this trick? in general it is very good for CrossPlatforms = Android, Linux, BeOs..?
C:Q2=It is good-solution for Move_i04,Move_i06? at means I replace
copymemory with
Procedure Move_i04(const ASource; var ADest; ACount: Integer);
Procedure Move_i08(const ASource; var ADest; ACount: Integer);
Procedure Move_f08(src:pchar;ADest:pchar; ACount: Integer);
Thank.

BrunoK:
In a few cases, I move the memory (allal televisions the fixed memory 32 characters to fix a project point.lpr).
In this case, a wearer, pause Jeis repackaging the copy memory with Move-i32, but
the program-develling which is 100% secure in size of 32 characters.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Good10Solutionl ProcedureVar knt: whole meter;Start  //more quick   for cnt:= 1 before (01cl 20) do Move_i32(srce, dest,32);The End; Slow10SolutionProcedure;Var knt: whole meter;Start   for n:= 1 before (01 wast 20) make a copy(dest,srce,32);The End;

marcov:
These are old D7 tricks, but the FPC move uses sse2 if available, and afaik so does D2006+

Did you test this is necessary at all? 

Thaddy:
Better not use that trick:
The compiler is often more efficient and your code is not portable.
It was OK about 20 years ago, though.

Navigation

[0] Message Index

Go to full version