We have a RO server created with Delphi XE2 and RO SDK version 8.3.93.1183
Later this year year we migrated to SDK version 9.4.107.1363
Several methods return (sometimes big) json packets (as strings) and these strings are declared as Utf8String in the RODL interface.
After migrating to 9.4 one of our customers reported that our application server was significantly slower than previous version (built with SDK 8.3). Took us several days to figure out that the migration to newer RO SDK was the culprit.
Then I decided to create and run isolated test cases, so I could compare the performance. I created a simple project (both server and client) and exposed 5 methods. This is the server interface:
TNewService = class(TRORemoteDataModule, INewService)
public
function Sum(const A: Integer; const B: Integer): Integer; virtual;
function GetServerTime: DateTime; virtual;
function GetAnsiString: ROAnsiString; virtual;
function GetUtf8String: ROUTF8String; virtual;
function GetWideString: UnicodeString; virtual;
end;
The same RODL file was used to create the exact same server/client with both versions. They are based on Synapse super TCP server/channel.
All 3 string methods create a big string using the same underlying data type as the result (i.e. there is no implicit conversion of string types) and are called in a loop from the client. Nothing else. This is the performance data (numbers were obtained using TStopwatch.ElapsedTicks):
8.3 (client and server)
GetAnsiString = 44029563
GetUtf8String = 43973187
GetWideString = 90918905
Sum = 385212
GetServerTime = 384935
8.3 (server) / 9.4 (client)
GetAnsiString = 53672772
GetUtf8String = 54033906
GetWideString = 93295080
Sum = 416417
GetServerTime = 405752
9.4 (client and server)
GetAnsiString = 63895384
GetUtf8String = 62832517
GetWideString = 94493844
Sum = 403969
GetServerTime = 410536
9.6 (client and server)
GetAnsiString = 62941979
GetUtf8String = 61733501
GetWideString = 92866095
Sum = 432470
GetServerTime = 422576
9.6 (client and server - built with $DEFINE CODEGEN4_LEGACYSTRINGS )
GetAnsiString = 70931538
GetUtf8String = 69630090
GetWideString = 96666900
Sum = 421897
GetServerTime = 424205
As you can see, methods that return AnsiString/Utf8String are significantly slower (around 22%) in 9.x branch, even if I enable legacy strings through CODEGEN4_LEGACYSTRINGS compiler directive.
Please notice that both client and server are slower when built with new version (see mixed case above).
This imposes a HUGE problem for us because:
1- The performance impact is not acceptable
2- we had to rollback RO SDK and restore older version
3- we can’t deploy our new branch built with Delphi 10.3 because there is no RO SDK 8.3 for it (i.e. we are stuck in Delphi XE2 until RO finds a solution for this problem)
If you need I can provide all source code used in the tests and all collected data but we definitely need to find a solution for this.
Cheers