Added "Speed" button in activerecord_showcase sample

This commit is contained in:
Daniele Teti 2022-11-20 00:51:57 +01:00
parent 8b7ec97819
commit f0aa9e76d6
3 changed files with 15 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

@ -1261,16 +1261,21 @@ var
I: Integer;
lCustomers: TArray<TCustomer>;
lSW: TStopWatch;
lElapsedMS: UInt32;
const
INSTANCES_COUNT = 2000000;
begin
TMVCActiveRecord.DeleteAll(TCustomer);
SetLength(lCustomers, 2000000);
SetLength(lCustomers, INSTANCES_COUNT);
lSW := TStopwatch.StartNew;
for I := Low(lCustomers) to High(lCustomers) do
for I := 0 to INSTANCES_COUNT - 1 do
begin
lCustomers[I] := TCustomer.Create;
end;
Log('Created ' + Length(lCustomers).ToString + ' TCustomer instances in ' + lSW.ElapsedMilliseconds.ToString + 'ms');
for I := Low(lCustomers) to High(lCustomers) do
lElapsedMS := lSW.ElapsedMilliseconds;
Log(Format('Created %s TCustomer instances in %d ms',
[FormatFloat('###,###,###', INSTANCES_COUNT), lElapsedMS]));
for I := 0 to INSTANCES_COUNT - 1 do
begin
lCustomers[I].Free;
end;

View File

@ -164,6 +164,12 @@
</Delphi.Personality>
<Deployment Version="4">
<DeployFile LocalName="bin\activerecord_showcase.exe" Configuration="BUILD" Class="ProjectOutput"/>
<DeployFile LocalName="bin\activerecord_showcase.exe" Configuration="BUILD" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>activerecord_showcase.exe</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployFile LocalName="bin\activerecord_showcase.exe" Configuration="BULD" Class="ProjectOutput"/>
<DeployFile LocalName="bin\activerecord_showcase.exe" Configuration="Debug" Class="ProjectOutput"/>
<DeployFile LocalName="bin\activerecord_showcase.exe" Configuration="POSTGRESQL" Class="ProjectOutput"/>