-
-
Save OkobaPatino/cec68181d27ee9e724c6f3358984f5c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1000000, FALSE, FALSE | |
Add: 540567 | |
Find: 128002 | |
1000000, FALSE, TRUE | |
Add: 604211 | |
Find: 144755 | |
1000000, TRUE, FALSE | |
Add: 138788 | |
Find: 76406 | |
1000000, TRUE, TRUE | |
Add: 147384 | |
Find: 87198 | |
10000000, FALSE, FALSE | |
Add: 9379296 | |
Find: 1917793 | |
10000000, FALSE, TRUE | |
Add: 10095041 | |
Find: 2061606 | |
10000000, TRUE, FALSE | |
Add: 1822755 | |
Find: 1216051 | |
10000000, TRUE, TRUE | |
Add: 1877121 | |
Find: 1253445 | |
20000000, FALSE, FALSE | |
Add: 20407971 | |
Find: 4052427 | |
20000000, FALSE, TRUE | |
Add: 20995270 | |
Find: 4245085 | |
20000000, TRUE, FALSE | |
Add: 3725099 | |
Find: 2495713 | |
20000000, TRUE, TRUE | |
Add: 3837673 | |
Find: 2658456 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1000000, FALSE, FALSE | |
Add: 419520 | |
Find: 85204 | |
1000000, FALSE, TRUE | |
Add: 578866 | |
Find: 145499 | |
1000000, TRUE, FALSE | |
Add: 115279 | |
Find: 65541 | |
1000000, TRUE, TRUE | |
Add: 145580 | |
Find: 87212 | |
10000000, FALSE, FALSE | |
Add: 6090328 | |
Find: 1246230 | |
10000000, FALSE, TRUE | |
Add: 9648824 | |
Find: 1980566 | |
10000000, TRUE, FALSE | |
Add: 1486695 | |
Find: 949194 | |
10000000, TRUE, TRUE | |
Add: 1841067 | |
Find: 1249406 | |
20000000, FALSE, FALSE | |
Add: 13273930 | |
Find: 2744949 | |
20000000, FALSE, TRUE | |
Add: 20506971 | |
Find: 4120187 | |
20000000, TRUE, FALSE | |
Add: 3017470 | |
Find: 1962430 | |
20000000, TRUE, TRUE | |
Add: 3748008 | |
Find: 2687383 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program project1; | |
uses | |
mormot.core.base, | |
mormot.core.perf, | |
mormot.crypt.core, | |
mormot.core.text, | |
mormot.core.json; | |
procedure Test(Count: Integer; SetCapacity: Boolean; RandomString: Boolean); | |
var | |
Timer: TPrecisionTimer; | |
I: Integer; | |
Dic: TSynDictionary; | |
A: TRawUtf8DynArray; | |
begin | |
WriteLn(Count, ', ', SetCapacity, ', ', RandomString); | |
SetLength(A, Count); | |
for I := 0 to High(A) do | |
if RandomString then | |
A[I] := GuidToRawUtf8(RandomGuid) | |
else | |
A[I] := UInt32ToUtf8(I); | |
Dic := TSynDictionary.Create(TypeInfo(TRawUtf8DynArray), TypeInfo(TIntegerDynArray)); | |
if SetCapacity then | |
Dic.Capacity := Length(A); | |
Timer.Start; | |
for I := 0 to High(A) do | |
Dic.Add(A[I], I); | |
WriteLn('Add: ', Timer.StopInMicroSec); | |
Timer.Start; | |
for I := 0 to High(A) do | |
Dic.Find(A[I]); | |
WriteLn('Find: ', Timer.StopInMicroSec); | |
end; | |
var | |
Count: Integer; | |
SetCapacity: Boolean; | |
RandomString: Boolean; | |
begin | |
for Count in [1, 10, 20] do | |
for SetCapacity in [False, True] do | |
for RandomString in [False, True] do | |
Test(Count * 1000000, SetCapacity, RandomString); | |
ReadLn; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment