#1 2013-03-07 16:08:55

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

64 bit compatibility of mORMot core units

I'm happy to announce that the today's commit fixed most 64 bit compilation problems of mORMot.
See http://synopse.info/fossil/info/fb893df6fe

ORM and services are now working.
Low-level x64 assembler stubs have been created and tested.

I suspect some part of official System.RTTI unit as provided in XE2/XE3 is broken in Win64.
For instance, I think it does not handle a method returning a string.
Our mORMot.pas implementation has been tested with the same regression code as in 32 bit mode.
Your own tests and feedback are welcome.

SQlite3 works great in 64 bit mode.
I've used the 3.7.10 dll version included in http://sourceforge.net/p/zeoslib/code-0 … lite/Win64 - since there is no official Win64 library released in http://sqlite.org
No problem so far, and pretty good performance.
Jut a weird bug of SQLITE_TRANSIENT constant, which should be pointer(integer(-1)) instead of pointer(-1) when working with virtual tables columns - but nothing to care of in your user code, since the framework will do it for you.

Still needs to test SynDB* units, and UI part of the framework.
Should not be the highest priority, I suppose, since most interest in 64 bit is on server side.

Resulting speed is great - just a bit slower than 32 bit version (10-20%).
Speed decrease seems to be mostly due to doubled pointer size, and some less optimized part of the official Delphi RTL.
But Synopse core uses its own functions (e.g. for JSON serialization, RTTI support or interface calls or stubbing), so we were able to release the whole 64 bit power of your hardware.
Delphi 64 bit compiler sounds stable and efficient.


Regression tests passed as such:

   Synopse mORMot Framework Automated tests
  ------------------------------------------


1. Synopse libraries

 1.1. Low level common:
  - System copy record: 22 assertions passed  148us
  - TDynArray: 959,443 assertions passed  111.75ms
  - TDynArrayHashed: 1,200,629 assertions passed  97.36ms
  - Fast string compare: 7 assertions passed  93us
  - IdemPropName: 10 assertions passed  86us
  - Url encoding: 105 assertions passed  602us
  - IsMatch: 599 assertions passed  134us
  - Soundex: 35 assertions passed  65us
  - Numerical conversions: 786,378 assertions passed  77.90ms
  - Curr64: 20,053 assertions passed  1.93ms
  - CamelCase: 5 assertions passed  56us
  - Bits: 4,614 assertions passed  68us
  - Ini files: 7,004 assertions passed  50.00ms
  - Unicode - Utf8: 65,089 assertions passed  733.31ms
  - Iso8601 date and time: 24,000 assertions passed  3.24ms
  - Url decoding: 1,100 assertions passed  231us
  - TSynTable: 41 assertions passed  1.36ms
  - TSynCache: 404 assertions passed  518us
  - TSynFilter: 804 assertions passed  1.51ms
  - TSynValidate: 677 assertions passed  519us
  - TSynLogFile: 42 assertions passed  323us
  Total failed: 0 / 3,071,061  - Low level common PASSED  1.08s

 1.2. Low level types:
  - RTTI: 34 assertions passed  299us
  - Url encoding: 200 assertions passed  426us
  - Encode decode JSON: 251,055 assertions passed  74.03ms
  Total failed: 0 / 251,289  - Low level types PASSED  76.98ms

 1.3. Big table:
  - TSynBigTable: 19,264 assertions passed  32.59ms
  - TSynBigTableString: 16,248 assertions passed  14.13ms
  - TSynBigTableMetaData: 384,060 assertions passed  763.51ms
  - TSynBigTableRecord: 452,185 assertions passed  1.67s
  Total failed: 0 / 871,757  - Big table PASSED  2.48s

 1.4. Cryptographic routines:
  - Adler32: 1 assertion passed  290us
  - MD5: 1 assertion passed  187us
  - SHA1: 5 assertions passed  187us
  - SHA256: 5 assertions passed  91us
  - AES256: 6,372 assertions passed  121.16ms
  - Base64: 11,994 assertions passed  69.84ms
  Total failed: 0 / 18,378  - Cryptographic routines PASSED  194.71ms

 1.5. Compression:
  - In memory compression: 12 assertions passed  315.31ms
  - Gzip format: 19 assertions passed  612.19ms
  - Zip format: 36 assertions passed  1.10s
  - SynLZO: 3,006 assertions passed  63.48ms
  - SynLZ: 3,006 assertions passed  78.12ms
  Total failed: 0 / 6,079  - Compression PASSED  2.17s

 1.6. Synopse PDF:
  - TPdfDocument: 4 assertions passed  4.29ms
  - TPdfDocumentGDI: 3 assertions passed  41.36ms
  Total failed: 0 / 7  - Synopse PDF PASSED  46.75ms


2. mORMot

 2.1. File based:
  - Database direct access: 10,136 assertions passed  170.33ms
  - Virtual table direct access: 12 assertions passed  2.64ms
  - TSQLTableJSON: 19,030 assertions passed  25.96ms
  - TSQLRestClientDB: 604,036 assertions passed  2.14s
  Total failed: 0 / 633,214  - File based PASSED  2.34s

 2.2. File based WAL:
  - Database direct access: 10,136 assertions passed  149.64ms
  - Virtual table direct access: 12 assertions passed  1.44ms
  - TSQLTableJSON: 19,030 assertions passed  23.50ms
  - TSQLRestClientDB: 604,036 assertions passed  2.11s
  Total failed: 0 / 633,214  - File based WAL PASSED  2.29s

 2.3. Memory based:
  - Database direct access: 10,136 assertions passed  141.05ms
  - Virtual table direct access: 12 assertions passed  1.38ms
  - TSQLTableJSON: 19,030 assertions passed  22.33ms
  - TSQLRestClientDB: 672,330 assertions passed  2.54s
  Total failed: 0 / 701,508  - Memory based PASSED  2.71s

 2.4. Basic classes:
  - TSQLRecord: 52 assertions passed  283us
  - TSQLRecordSigned: 200 assertions passed  4.71ms
  - TSQLModel: 3 assertions passed  106us
  Total failed: 0 / 255  - Basic classes PASSED  6.41ms

 2.5. Client server access:
  - TSQLHttpServer: 21 assertions passed  9.45ms
     using THttpApiServer
  - TSQLHttpClient: 3 assertions passed  22.92ms
  - Http client keep alive: 3,084 assertions passed  201.33ms
     4803 B, first 3.58ms, done 190.26ms i.e. 5255/s, aver. 190us, 24.5 MB/s
  - Http client multi connect: 3,084 assertions passed  188.08ms
     4803 B, first 399us, done 181.72ms i.e. 5502/s, aver. 181us, 25.7 MB/s
  - Named pipe access: 3,086 assertions passed  534.92ms
     4803 B, first 256.33ms, done 76.05ms i.e. 13149/s, aver. 76us, 61.4 MB/s
  - Local window messages: 3,085 assertions passed  46.84ms
     4803 B, first 93us, done 40.98ms i.e. 24402/s, aver. 40us, 114.0 MB/s
  - Direct in process access: 3,053 assertions passed  36.90ms
     4803 B, first 40us, done 36.03ms i.e. 27750/s, aver. 36us, 129.7 MB/s
  Total failed: 0 / 15,416  - Client server access PASSED  1.04s

 2.6. Service oriented architecture:
  - Weak interfaces: 56 assertions passed  287us
  - Service initialization: 129 assertions passed  1.83ms
  - Direct call: 602,472 assertions passed  27.34ms
  - Server side: 602,482 assertions passed  27.63ms
  - Client side REST: 602,484 assertions passed  408.54ms
  - Client side JSONRPC: 602,482 assertions passed  439.67ms
  - Client side synchronized REST: 602,482 assertions passed  813.85ms
  - Security: 135 assertions passed  1.01ms
  - Custom record layout: 602,482 assertions passed  427.91ms
  - Mocks and stubs: 30,031 assertions passed  49.06ms
  Total failed: 0 / 3,645,235  - Service oriented architecture PASSED  2.20s

 2.7. External database:
  - External records: 1 assertion passed  1.05ms
  - Auto adapt SQL: 186 assertions passed  16.80ms
  - Crypted database: 176,192 assertions passed  167.08ms
  - External via REST: 243,444 assertions passed  604.71ms
  - External via virtual table: 243,444 assertions passed  1.10s
  Total failed: 0 / 663,267  - External database PASSED  1.89s


Synopse framework used: 1.18
SQlite3 engine used: 3.7.10
Generated with: Delphi XE3 64 bit compiler

Time elapsed for all tests: 18.58s
Tests performed at 07/03/2013 16:03:09

Total assertions failed for all test suits:  0 / 10,510,680
! All tests passed successfully.

Done - Press ENTER to Exit

Note that the same tests run in less than 16 seconds when compiled in 32 bit - but with real server work, I do not think it would make a sensible difference.

Offline

#2 2013-03-11 07:32:45

Eric
Member
Registered: 2012-11-26
Posts: 129
Website

Re: 64 bit compatibility of mORMot core units

Nice job!

64bit compiler is quite stable IME, but the 64bit debugger can be a bit more problematic (at least in XE2)

A lot of the 64bit RTL is quite less efficient, several fastcode routines and previously (old) well-thought out RTL asm routines were replaced by Pascal ones that suffer from a mix of poor implementation/algorithmic choices and compiler optimization limitations. So comparatively, the Synopse routines should be even more preferable in 64bit.

Offline

#3 2013-03-11 07:45:00

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

Re: 64 bit compatibility of mORMot core units

Under XE3, the 64 bit debugger did only break once a day (on average). So it was perfectly usable.
Compilation is much slower for Win64, but still usable, at least when re-building the whole mORMot units.

Eric wrote:

A lot of the 64bit RTL is quite less efficient, several fastcode routines and previously (old) well-thought out RTL asm routines were replaced by Pascal ones that suffer from a mix of poor implementation/algorithmic choices and compiler optimization limitations. So comparatively, the Synopse routines should be even more preferable in 64bit.

This is exactly what we have observed: by-passing the RTL is of some obvious benefit here!
As I wrote above: "Synopse core uses its own functions (e.g. for JSON serialization, RTTI support or interface calls or stubbing), so we were able to release the whole 64 bit power of your hardware".

Thanks for the feedback.

Offline

#4 2013-03-11 14:11:44

corchi72
Member
Registered: 2010-12-10
Posts: 232

Re: 64 bit compatibility of mORMot core units

I just tried to compile 64-bit XE2 but an error occurs at compile time:

[DCC Error] mORMoti18n.pas(1025): E2116 Invalid combination of opcode and operands


Can you give me a hint?

Thanks corchi

Offline

#5 2013-03-11 16:44:30

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

Re: 64 bit compatibility of mORMot core units

I've made mORMoti18n.pas and SynTaskDialog.pas units compatible with Win64 platform.

Now the main SynFile demo is compiling and working as expected.
Including reporting (pdf export and gdi+ anti aliaising), toolbar auto-definition from TSQLModel, all task dialogs, etc...
smile

See http://synopse.info/fossil/timeline

Offline

#6 2013-03-12 08:38:05

corchi72
Member
Registered: 2010-12-10
Posts: 232

Re: 64 bit compatibility of mORMot core units

sorry but I could test the new version (2013-03-11 21:19:08) only just now, and this is the error occurs at compile time:

[DCC Error] mORMotToolBar.pas(1088): E2064 Left side cannot be assigned to


Thank corchi

Offline

#7 2013-03-12 10:25:42

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

Re: 64 bit compatibility of mORMot core units

I just tried with Delphi 7 and XE3.
No problem for compiling the latest version.
Did you retrieve all versions?
I just posted an alternate syntax, perhaps Delphi XE2 compiler will prefer this.

I've seen that you must set Optimization=TRUE at compilation time, otherwise there are some potential issues when launching.

Offline

#8 2013-03-12 16:29:03

corchi72
Member
Registered: 2010-12-10
Posts: 232

Re: 64 bit compatibility of mORMot core units

ok I have tested last version  2013-03-12 12:56:39 and it worked!!!


Thansk corchi

Offline

Board footer

Powered by FluxBB