In fact, if you check the code, SortDynArrayString() is never called by TDynArray.
The mORMot code will select automatically SortDynArrayAnsiString(const A, B) which is very optimized, and written in hand tuned ASM for both i386 and x86_64. It compares the first char ASAP to enhance sort, and can compare one pointer size (4 or 8 bytes) at a time in its internal loop. See PT_SORT[] in mormot.core.data.
procedure Test;
var
I, C: Int64;
A, B: String;
T: TLocalPrecisionTimer;
begin
A := 'Hello World';
UniqueString(A);
B := 'Hello World';
UniqueString(B);
C := 0;
T := TLocalPrecisionTimer.CreateAndStart;
for I := 1 to 50 * 1000 * 1000 do
if A = B then //_ansistr_compare_equal //95ms
//if SortDynArrayString(A, B) = 0 then
//if StrComp(PChar(A), PChar(B)) = 0 then //367ms
C += 1;
Writeln(C, ' ', T.Stop);
end;