You are not logged in.
I did a small test with real code scenario,
look at parallel zlib with my patch, zcompress loop 1000 of a 1100KB text file:
uses System.Zlib;
threadvar
INS: TMemoryStream;
OUTS: pointer;
SizeIn: integer;
SizeOUT: integer;
procedure TForm.CompressClick(Sender: TObject);
var
Count: integer;
begin
Count := GetTickCount;
TParallel.For(1,1000,procedure(I:integer)
begin
INS := TMemoryStream.Create;
INS.LoadFromFile('c:\teststream.txt');
SizeIn := INS.Size;
GetMem(OUTS, SizeIn);
SizeOUT := SizeIn;
ZCompress(INS.Memory, SizeIn, OUTS, SizeOUT, zcFastest);
INS.Free;
FreeMem(OUTS);
end);
ShowMessage(IntToStr(GetTickCount - Count));
end;
- fastmm4 900-1000msec
- brainMM 563msec
- msheap 532msec
- my patch Intel IPP + TTB 281 msec
www.dellapasqua.com
www.dellapasqua.com/intelTBB.rar (put a teststream.txt file on c:\ and run files)
Offline
I would put LoadFromFile outside the loop, using a temporary buffer, because it clearly introduces some unneeded API calls in the numbers.
I would not call your test a "real case", since it is clear to me that the INS and OUTS memory allocations, bigger than 1MB, will by-pass the memory manager small blocks, and call directly the OS.
A "real case" test would be allocating a lot of small blocks (like strings or objects), not 1MB of memory.
I'm afraid your code is leaking memory.
You allocate OUTS before ZCompress, but ZCompress will also allocate the buffer.
So what you are testing here is the speed of a memory leak, and the speed of a ReallocMem over 1MB...
Not a good proof to me!
Offline