BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How is the "penalty for size" defined?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM
View previous topic :: View next topic  
Author Message
John Herbster
Guest





PostPosted: Mon Nov 06, 2006 8:02 pm    Post subject: How is the "penalty for size" defined? Reply with quote



In the voting for the "penalty for size constant be for StrToInt32",
what is the devinition of the "penalty for size" constant?
--JohnH
Back to top
Dennis
Guest





PostPosted: Mon Nov 06, 2006 9:01 pm    Post subject: Re: How is the "penalty for size" defined? Reply with quote



Hi John

We calculate benchmark values for size penalty targets by

Benchmark := Speed - Size * PenaltyForSizeConstant;

or


Benchmark := RunTime + Size * PenaltyForSizeConstant;

Best regards
Dennis Kjaer Christensen

----------------------------------------------------------------------------
----
Jeg beskyttes af den gratis SPAMfighter til privatbrugere.
Den har indtil videre sparet mig for at få 4969 spam-mails
Betalende brugere får ikke denne besked i deres e-mails.
Hent en gratis SPAMfighter her.
Back to top
John Herbster
Guest





PostPosted: Mon Nov 06, 2006 9:29 pm    Post subject: Re: How is the "penalty for size" defined? Reply with quote



"Dennis" <marianndkc (AT) home3 (DOT) gvdnet.dk> wrote
Quote:
We calculate benchmark values for size penalty targets by
Benchmark := Speed - Size * PenaltyForSizeConstant;
or
Benchmark := RunTime + Size * PenaltyForSizeConstant;

That does not seem to make sense to me.
May I presume that
Size = <code space> + <stack space> + <heap space>
Speed = -RunTime
or
Speed = 1/RunTime
and
RunTime = CPU_Cycles/NbrRepeats
or
RunTime = CPU_Cycles for NbrRepeats
where NbrRepeats is otherwise specified somewhere?
If so, then where? Rgds, JohnH
Back to top
Dennis
Guest





PostPosted: Tue Nov 07, 2006 9:12 am    Post subject: Re: How is the "penalty for size" defined? Reply with quote

Hi John

Quote:
May I presume that

No you may not. Look in the B&V's for actual implementations or ask here.

Of course it makes sense what we are doing ;-)

Take a look at our spreadsheets and our SpreadsheetCreator.

A typical benchmark is like this

function TMainForm.SubBenchmark1 : Double;
var
J, I5, K : Cardinal;
I1 : Integer;
RunNo : Cardinal;
RunTimeSec : Double;
lpPerformanceCount, StartCount, EndCount, NoOfTicks, MinNoOfTicks : Int64;

begin
I1 := 0;
for J := 1 to NOOFRERUNS do
begin
if QueryPerformanceCounter(lpPerformanceCount) then
StartCount := lpPerformanceCount
else
raise Exception.Create('QueryPerformanceCounter failed');
for RunNo := 1 to MAXNOOFRUNSSUB1 do
for K := 0 to Length(SubBenchmark1StringArray)-1 do
begin
//Use testset
I1 := StrToInt32Function(SubBenchmark1StringArray[K]);
end;
if QueryPerformanceCounter(lpPerformanceCount) then
EndCount := lpPerformanceCount
else
raise Exception.Create('QueryPerformanceCounter failed');
NoOfTicks := EndCount - StartCount;
if NoOfTicks < 0 then
raise Exception.Create('Tick counter wrapped around');
NoOfTicksArray[J-1] := NoOfTicks;
end;
ResultEdit.Text := IntToStr(I1);
//Get fastest run
MinNoOfTicks := NoOfTicksArray[0];
for I5 := 1 to NOOFRERUNS-1 do
begin
if NoOfTicksArray[I5] < MinNoOfTicks then
MinNoOfTicks := NoOfTicksArray[I5];
end;
RunTimeSec := MinNoOfTicks / Frequency;
Result := Round(RunTimeSec*SUBBENCH1SCALE);
end;

It measures the runtime for a bunch of scenario. Shorter runtime is better.

The sizeforpenalty simply makes the benchmark result look worse by adding
Size*SizeForPenaltyConstant to it.

The SpreadsheetCreator has functionality to list winners as function of
SizeForPenaltyConstant. This proves the concept. I give this list prior to
all polls. Functions can be winners if there are no smaller function with
more speed. We select a winner function with a certain compromise between
size and speed by chosing a SizeForPenaltyConstant.

Best regards
Dennis Kjaer Christensen

----------------------------------------------------------------------------
----
Jeg beskyttes af den gratis SPAMfighter til privatbrugere.
Den har indtil videre sparet mig for at få 5172 spam-mails
Betalende brugere får ikke denne besked i deres e-mails.
Hent en gratis SPAMfighter her.
Back to top
John Herbster
Guest





PostPosted: Thu Nov 09, 2006 6:30 pm    Post subject: Re: How is the "penalty for size" defined? Reply with quote

"Dennis" <marianndkc (AT) home3 (DOT) gvdnet.dk> wrote
Quote:
... look at our spreadsheets and our SpreadsheetCreator ...

I have Googled for these w/o success. Where may they be found?
Rgds, JohnH
Back to top
Dennis
Guest





PostPosted: Thu Nov 09, 2006 8:18 pm    Post subject: Re: How is the "penalty for size" defined? Reply with quote

Hi

At our site and at our Yahoo group.

http://www.fastcodeproject.org/

Best regards
Dennis Kjaer Christensen

----------------------------------------------------------------------------
----
Jeg beskyttes af den gratis SPAMfighter til privatbrugere.
Den har indtil videre sparet mig for at få 5265 spam-mails
Betalende brugere får ikke denne besked i deres e-mails.
Hent en gratis SPAMfighter her.
Back to top
John Herbster
Guest





PostPosted: Thu Nov 09, 2006 9:14 pm    Post subject: Re: How is the "penalty for size" defined? Reply with quote

Thanks, Dennis.
I have downloaded, compiled, and run the Spreadsheet Creator.
It looks nice, but I have a suggestion: If you want to make it more
understandable to programmers new to the FastCode work, then
I suggest that you add more definitions for the terms used and the
values presented. However, if I am the only non-participant
interested then there is no need.
Regards, JohnH
Back to top
Dennis
Guest





PostPosted: Fri Nov 10, 2006 2:20 am    Post subject: Re: How is the "penalty for size" defined? Reply with quote

Hi John

It is only an internal tool, but it still needs some work. It is very rough
on the edges. I need to prioritize my limited resources and it is more
important to work on B&V's and it is also important to make support for FP
based challenges in the SpreadsheetCreator or make another version for it. I
spend a little time now and then to polish it up and it is slowly reaching
1.0.0 standard.

Best regards
Dennis Kjaer Christensen

----------------------------------------------------------------------------
----
Jeg beskyttes af den gratis SPAMfighter til privatbrugere.
Den har indtil videre sparet mig for at få 5271 spam-mails
Betalende brugere får ikke denne besked i deres e-mails.
Hent en gratis SPAMfighter her.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Language BASM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.