Even brute force was better then Delphi !
From: The Half A Wannabee ("The)
Date: 02/25/04
- Next message: Bx.C: "Re: numbers written in ascii... looking for all common (and some uncommon) forms...."
- Previous message: The Half A Wannabee: "Re: A (mild-mannered) defense of RosAsm Rocks !!!"
- Next in thread: The Half A Wannabee: "Re: Even brute force was better then Delphi !"
- Reply: The Half A Wannabee: "Re: Even brute force was better then Delphi !"
- Reply: pgx_at_pgrahams.com: "Re: Even brute force was better then Delphi !"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 25 Feb 2004 04:06:25 +0100
Delphi timings for 100_000_000 IntToString calls inside a loop
0,000-5,000-Start
210 537 760,000-210 537 760,000-Stopp
*First* RosAsm, brute force implementation :
Start 100_000_000 calls to IntegerToString :015 015
STOPP 100_000_000 calls to IntegerToString :175259271 175259256
Timings are given in TICKS. and on my machine, the counter ticks 3579545 per
second
This means DELPHI code took a total of ~58,82 seconds and RosAsm brute
force newbie code took ~48,96 seconds.
Speed improvement just from using RosAsm instead of Delphi = 17.24 % for my
first attempts ! Note that I had to write the PerformanceCounter in Delphi
too, so its not like development times are very much faster in delphi, even
for my very short experience. (RosAsm was 3 hours or so, but is not yet
complete) I do a lot of mistakes, and I would guess that when I am more
comfty with asm, development time with RosAsm will beat Delphi by
magnitudes. I see no reason not to program in asm, also when we talk about
the fun of programming. For other newbs, that are thinking of going asm
only. I dont think you will never regrett it. I thought I knew something
about programming, but rescent weeks have shown that I knew nothing, and
that the reason was for not using an assembler. Yes there is some startup
overhead, and many small irritating small problems to solve, but every day
you learn something new and existing, that you can use in all languages you
will program in, when you have to later.
Delphi code :
Procedure TSkinAppMAINWindow.ProgramStartup;
var
j : integer;
S : String;
begin
Show;
gPerformanceCounter := TPerformanceCounter.Create(lpNoparams);
gPerformanceCounter.Start;
gPerformanceCounter.TimeStampRemark('Start');
for j := 0 to 100000000 do
begin
S := IntToStr( j )
end;
gPerformanceCounter.TimeStampRemark('Stopp');
gPerformanceCounter.Stopp(false);
gPerformanceCounter.SaveTofileAsText(gDesktopDir + '\Perf.txt');
gPerformanceCounter.Free;
end;
RosAsm code :
PerformanceCounter_SelfTest:
Push edi
mov D$WindowUtilDirectoryFlags 1
call WindowUtil_OleSupport_Start
call TPerformanceCounter_Create | mov D$PerformanceCounter edi
call TPerformanceCounter_Start
call TPerformanceCounter_TimeStampRemark TestRemark1
mov ecx 100_000_000
@TestPerformance:
push ecx
mov eax ecx |mov edx 0
Call StringManager_IntegerToString
Call StringManager_DisposeString eax
pop ecx
dec ecx
jnz @TestPerformance
call TPerformanceCounter_TimeStampRemark TestRemark2
call TPerformanceCounter_Stop &FALSE
push edi esi
mov eax D$gDesktopDir
call FileManager_ComposeFullFileNameEAX D$eax + TString_Pchar
PerformanceFileName
Call TPerformanceCounter_SaveToTextFile D$eax + TString_Pchar
pop esi edi
Call TPerformanceCounter_Destroy
call WindowUtil_OleSupport_Shutdown
pop edi
call TSkinSection_SetDisabled
call TSZSkinWindow_RepaintWindow
ret
The performanceCounter is not completed yet, and only useful for small
timings. So complete code will be posted later. But for the current use, the
link is here :
http://www.szmyggenpv.com/downloads/PerformanceCounter.Zip
- Next message: Bx.C: "Re: numbers written in ascii... looking for all common (and some uncommon) forms...."
- Previous message: The Half A Wannabee: "Re: A (mild-mannered) defense of RosAsm Rocks !!!"
- Next in thread: The Half A Wannabee: "Re: Even brute force was better then Delphi !"
- Reply: The Half A Wannabee: "Re: Even brute force was better then Delphi !"
- Reply: pgx_at_pgrahams.com: "Re: Even brute force was better then Delphi !"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|