|
|
导航: |
论坛 -> DELPHI技术
斑竹:liumazi,sephil |
|
作者: |
|
2018/6/16 19:55:01 |
标题: |
|
加入我的收藏 |
楼主: |
还有更厉害的吗?
此帖子包含附件:
大小:92.3K |
----------------------------------------------
[alias] co = clone --recurse-submodules up = submodule update --init --recursiveupd = pullinfo = statusrest = reset --hard懒鬼提速https://www.cctry.com/>http://qalculate.github.io/downloads.htmlhttps://www.cctry.com/ |
作者: |
|
2018/6/17 8:20:17 |
1楼: |
那个BrainMM和TCMalloc之类的在delphi中怎么使用?
----------------------------------------------
-
|
作者: |
|
2018/6/18 13:56:27 |
2楼: |
BrainMM->Demos->lib下有好几个MM的文件:FastMM/IntelTBB/MSHeap/SAPMM/ScaleMM2/TCMalloc。 把对应的文件放在DPR单元的第一位就可以了,以ScaleMM为例: program <YourApp>;
uses ScaleMM2 in '<yourpathscalemmpath>\ScaleMM2.pas', ...
----------------------------------------------
-
|
作者: |
vmao (毛小毛) |
★☆☆☆☆ |
-
|
盒子活跃会员 |
|
2018/6/19 8:27:06 |
3楼: |
不是官方自带的,能靠谱么?
----------------------------------------------
-
|
作者: |
|
2018/6/19 10:06:11 |
4楼: |
BrainMM 真不错。
----------------------------------------------
Delphi4Linux Delphi三层/FireDAC 技术群:734515869 http://www.cnblogs.com/rtcmw
|
作者: |
|
2018/6/19 10:16:55 |
5楼: |
program TestFastMM;
{$APPTYPE CONSOLE}
{$R *.res}
uses System.Diagnostics, System.TimeSpan, System.SysUtils, System.Classes, System.Generics.Collections, Winapi.Windows;
type TTestThread = class(TThread) public procedure Execute; override; end;
var Stopwatch: TStopwatch; Elapsed: TTimeSpan; ThreadList: TList<TThread>; Threads: array of TTestThread; iGlobal: Integer;
const C_StrL = 16351; { TTestThread }
procedure TTestThread.Execute; var CurrentStringList: TStringList; i: Integer; CurrentString: string; begin CurrentStringList := TStringList.Create; try for I := 1 to 1571000 do begin SetLength(CurrentString, Random(C_StrL)); SetLength(CurrentString, 0); CurrentStringList.Add(IntToStr(Random(i)) + 'bob' + IntToStr(Random(i))); end; finally CurrentStringList.Free; end; end;
begin
try Stopwatch := TStopwatch.StartNew;
SetLength(Threads, 40); // highly parallel ThreadList := TList<TThread>.Create; try for iGlobal := Low(Threads) to High(Threads) do begin Threads[iGlobal] := TTestThread.Create; ThreadList.Add(Threads[iGlobal]); end;
while ThreadList.Count > 0 do begin if ThreadList[0].WaitFor = WAIT_OBJECT_0 then begin CloseHandle(ThreadList[0].Handle);
ThreadList.Delete(0); end; Sleep(10); end; finally ThreadList.Free; end;
Elapsed := Stopwatch.Elapsed; Writeln(Format('FastMM took %n milliseconds', [Elapsed.TotalMilliseconds])); except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end;
ReadLn; end.
----------------------------------------------
-
|
作者: |
|
2018/6/19 10:18:51 |
6楼: |
这是网上测试多线程内存的例子,我的机32下BrainMM下有错
----------------------------------------------
-
|
作者: |
|
2018/6/19 10:21:42 |
7楼: |
楼上的 为啥不用 英特尔 或者 谷歌的 非要用 BrainMM ? 只是抛个砖而已..
----------------------------------------------
[alias] co = clone --recurse-submodules up = submodule update --init --recursiveupd = pullinfo = statusrest = reset --hard懒鬼提速https://www.cctry.com/>http://qalculate.github.io/downloads.htmlhttps://www.cctry.com/
|
作者: |
|
2018/6/19 11:35:16 |
8楼: |
scalemm2,里面是有鼐challenge benchmars程序,里面有一堆的测试场景,并比较各个MM,根据测试场景,设置相应的权重及占比分数,最后得到某一MM的得分。
总体得分是:fastmm的avx分支版本 速度快的是TC,scalemm(TBB未测试) 内存占用最小,我测试的是topMM
你们那点测试代码和场景太小,还不说是某MM在某项测试结果
----------------------------------------------
-
|
作者: |
|
2018/6/19 11:37:25 |
9楼: |
8楼的附件是MM benchmark,我之前有修改,有减少了些测试场景 原来的文件是从scalemm(请从githum找)目录下有个challenge找
注:benchmark只支持32位,没有64位的测试,因为里面很多是32位asm
----------------------------------------------
-
|
作者: |
|
2018/6/19 11:38:21 |
10楼: |
BrainMM 是还未稳定的,注意,我用它来跑这个测试是跑不过去的,写信给作者,也是回:未稳定,有BUG的
----------------------------------------------
-
|
作者: |
|
2018/6/19 14:26:10 |
11楼: |
TBB我测了,win32、多线程下,加载4k字段,3千条记录,然后zip压缩,比fastmm慢4倍,且内存占几倍
----------------------------------------------
-
|
作者: |
|
2018/6/19 14:34:51 |
12楼: |
多线程下,我之前对tbb期望很噶,但用了下,在某些情况,感觉很慢。还是fastmm,scalemm很可靠,美中不足scalemm少了内存泄露检测,
----------------------------------------------
-
|
作者: |
|
2018/6/19 16:08:53 |
13楼: |
可以试下QMM,有简单的泄露检查及少量字节的内存越界的检测
----------------------------------------------
-
|
作者: |
|
2018/6/19 16:17:15 |
14楼: |
泄露检查开关: 工程中设置宏:DEBUG(即DEBUG环境下),并ReportMemoryLeaksOnShutdown=true,则: 在程序退出后,如出现泄露,会产生一个文件:(yourapp).leak.txt 里面有个:QMM.如何查找内存泄露.txt,自行操作。
内存越界的检测: 1:工程中设置宏:DEBUG(即DEBUG环境下)
2:设置最大越界长度变量:suffix_mem_check 默认为:sizeof(Pointer)*4 值越大,表示检查越多,性能会相对影响,但可能越界的问题可能性会的更多点
// memory check size(after address) // NOTE: must be align sizeof(Pointer) suffix_mem_check = sizeof(Pointer) * 4;
----------------------------------------------
-
|
作者: |
|
2018/6/19 19:53:22 |
15楼: |
stack trace: $2513BF6 -> $251E69B -> $2524157 -> $251562A -> $772E919F -> $7779A8CB -> $7779A8A1 -> $0 QMM 这个数据可以选择生成 (好像JCL有提供这样的功能) MAP 然后查吗? 总的来说没FASTMM直观..
----------------------------------------------
[alias] co = clone --recurse-submodules up = submodule update --init --recursiveupd = pullinfo = statusrest = reset --hard懒鬼提速https://www.cctry.com/>http://qalculate.github.io/downloads.htmlhttps://www.cctry.com/
|
|