| View previous topic :: View next topic |
| Author |
Message |
John Herbster Guest
|
Posted: Mon Nov 06, 2006 8:02 pm Post subject: How is the "penalty for size" defined? |
|
|
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
|
Posted: Mon Nov 06, 2006 9:01 pm Post subject: Re: How is the "penalty for size" defined? |
|
|
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
|
Posted: Mon Nov 06, 2006 9:29 pm Post subject: Re: How is the "penalty for size" defined? |
|
|
"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
|
Posted: Tue Nov 07, 2006 9:12 am Post subject: Re: How is the "penalty for size" defined? |
|
|
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
|
Posted: Thu Nov 09, 2006 6:30 pm Post subject: Re: How is the "penalty for size" defined? |
|
|
"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
|
Posted: Thu Nov 09, 2006 8:18 pm Post subject: Re: How is the "penalty for size" defined? |
|
|
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
|
Posted: Thu Nov 09, 2006 9:14 pm Post subject: Re: How is the "penalty for size" defined? |
|
|
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
|
Posted: Fri Nov 10, 2006 2:20 am Post subject: Re: How is the "penalty for size" defined? |
|
|
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 |
|
 |
|