#1 2021-09-21 00:04:09

wxinix
Member
Registered: 2020-09-07
Posts: 121

mORMot2 performance on Win x64

I found mormot2 seems to be significantly slower with x64 built

The same application in x86 (32bit) build is almost 2 times faster then its x64 built.  Is this expected?

In other words,  is x86 (32bit) preferred for performance oriented application?

Offline

#2 2021-09-21 07:11:41

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: mORMot2 performance on Win x64

On my PC, the regression tests are faster on Win64 than Win32.

So if your app is significantly slower on Win64, my guess is that it does not come from normal work of the framework, but on your use case.
Enable the logs, or try to do some profiler, to find out what is actually slower.

Which compiler do you use? Which Memory Manager?

Offline

#3 2021-09-21 12:46:39

wxinix
Member
Registered: 2020-09-07
Posts: 121

Re: mORMot2 performance on Win x64

ab wrote:

On my PC, the regression tests are faster on Win64 than Win32.

So if your app is significantly slower on Win64, my guess is that it does not come from normal work of the framework, but on your use case.
Enable the logs, or try to do some profiler, to find out what is actually slower.

Which compiler do you use? Which Memory Manager?

Thank you ab for the heads up.

I use Delphi 10.4.2, and FastMM4-AVX memory manager (https://github.com/maximmasiutin/FastMM4-AVX), Release build.  But my previous test mistakenly enabled FullDebugMode for the RELEASE build.

Now that with your reminder,  I disabled FullDebugMode.  And re-run the test (using the Static Object List DB)

x86
Single Thread                  : 440842 records/sec inserts
Multi Thread (2 threads)    : 474982 records/sec inserts

x64:
Single Thread                  : 471051 records/sec inserts
Multi Thread (2 threads)    : 486679 records/sec inserts

So, in my case,  using Delphi default MM,
Single Thread,   x64 is 7.0% FASTER than 32bit
Multi   Thread,   x64 is 2.5% FASTER than 32 bit.

So you are right, x64 is indeed somewhat faster than x86.

Question - do you have any recommendation for memory manager to use?  Thank you again.

Last edited by wxinix (2021-09-21 12:47:56)

Offline

#4 2021-09-21 14:02:53

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: mORMot2 performance on Win x64

I would use the default memory manager on Delphi, and mORMot x86_64 memory manager on FPC.

You may try our mORMot x86_64 memory manager on Delphi Win64, which has less collisions for smallest memory blocks, so may be a bit faster on heavily multi-thread process.

Offline

#5 2021-09-21 15:19:50

wxinix
Member
Registered: 2020-09-07
Posts: 121

Re: mORMot2 performance on Win x64

ab wrote:

I would use the default memory manager on Delphi, and mORMot x86_64 memory manager on FPC.

You may try our mORMot x86_64 memory manager on Delphi Win64, which has less collisions for smallest memory blocks, so may be a bit faster on heavily multi-thread process.

Thank you again, ab!

I run another around of tests using the following Mem Manager:

Delphi Default
FastMM4-AVX
mormot.core.fpcx64mm
FastMM5


Delphi 10.4.2, Windows Server 2016, and x64 Release Build

And I found that FastMM5 would give the best performance, for both Multi, and Single thread.
FastMM5 > FastMM4-AVX > Delphi MM/mormot.core.fpcx64mm

Offline

#6 2021-09-21 17:01:09

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: mORMot2 performance on Win x64

mormot.core.fpcx64mm is less optimized on Win64 than it is on POSIX/Linux.

Note that FastMM5 has been reported in the forum as unstable for unknown reasons with some mORMot user code.
And its license is not Open Source, so I wouldn't advice using it, for ethical reasons - not technical of course.

Offline

#7 2021-09-22 13:22:58

Stefan
Member
Registered: 2012-11-23
Posts: 26

Re: mORMot2 performance on Win x64

ab wrote:

And its license is not Open Source

This is the second time I hear/read this (the other person was Macro on the Delphi 11 webinar) stating this: it is not accurate - FastMM5 is dual licensed, either GPL3 or a commercial paid license - see https://github.com/pleriche/FastMM5/blo … md#licence

While there might be some issue with mORMot we are using it for quite a while now on hundreds of customer installations on tenthousands of workstations.

Last edited by Stefan (2021-09-22 13:25:41)

Offline

#8 2021-09-22 15:37:05

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: mORMot2 performance on Win x64

You are right. But GPL 3 is a viral licence.
So if the application has not an explicit GPL 3 licence, a commercial paid licence is needed.

But I doubt most Delphi applications are GPL3... Do anyone know any, honestly?

Offline

#9 2021-09-22 16:53:48

Stefan
Member
Registered: 2012-11-23
Posts: 26

Re: mORMot2 performance on Win x64

To each their own - all I can say buying the V5 license at my company was a no-brainer and we have not looked back a single second.

Anyway, what I was getting at is that FastMM5 is open source - it is on Github and you can read the code, which is the definition of open source. Is it free? Well, that depends on what license you will choose. (yes, nitpicking, but I too often see people confuse open source with free)

Offline

#10 2021-09-22 20:04:29

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: mORMot2 performance on Win x64

For me, FastMM5 has a big limitation: it is for Windows and Delphi only IIRC.

And our need is to focus our performance on Linux, compiling with FPC, for efficient server side process.
The Windows clients are fast enough with the default memory manager.

This is why I wrote https://github.com/synopse/mORMot2/blob … cx64mm.pas targeting Linux x86_64 - it is basically FastMM4, cleaned and optimized for multi-thread and small blocks, with direct Linux API calls.
Win64 is less optimized when you resize a block. But it has been reported to work well on Win64 in terms of heavily multi-threaded Audio process, and loading huge memory blocks (>500MB) by Bero https://synopse.info/forum/viewtopic.ph … 476#p32476

Offline

Board footer

Powered by FluxBB