Benchmarking different algorithms (was Beginning/End of week)

David Morrison - Corporate dmorrison@mcbrideelectric.com
Tue, 9 Nov 2004 15:13:13 -0800


This is a multi-part message in MIME format.

------_=_NextPart_001_01C4C6B1.B0056588
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Blue,

No.  I used to do benchmarking, prior to upgrading our hardware 3 times =
in 9 years.  When I first started with PH, we had a slow machine that I =
needed to squeeze for CPU juice, so back then I did run some tests where =
I'd try something 2 or 3 ways, and run it 10,000 times to compare the =
elapsed time.

I never compared this kind of calculation, howeer, as it was never the =
bottleneck.

I do know that, generally speaking, division is a slow operation.  More =
important, though, in my opinion, is to make one's code visible, =
maintainable, and clonable.   I respectfully disagree with you that =
using FLOOR + division + multiplication (I'll call that 3 functions =
rather than 1) is a simplification over 2 data conversions and a =
substring.

Benchmarking would be interesting, here, wouldn't it?  Anyone want to =
try it out, on some different platforms?

Cordially,

David Morrison



>-----Original Message-----
>From: Robert Edis [mailto:robeconsult@sbcglobal.net]
>Sent: Tuesday, November 09, 2004 1:55 PM
>To: David Morrison - Corporate
>Subject: RE: Beginning / End of week
>
>
>This is interesting.  David, why do you say that using
>three functions is better than one?  I have been using
>FLOOR() to simplify logic rather than do data
>conversions.
>
>Do you have any benchmarks or a formulae to prove your
>hypotheses?
>
>Regards,
>
>Blue
>


------_=_NextPart_001_01C4C6B1.B0056588
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.0.6556.0">
<TITLE>Benchmarking different algorithms (was Beginning/End of =
week)</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><FONT SIZE=3D2 FACE=3D"Courier New">Blue,</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Courier New">No.&nbsp; I used to do =
benchmarking, prior to upgrading our hardware 3 times in 9 years.&nbsp; =
When I first started with PH, we had a slow machine that I needed to =
squeeze for CPU juice, so back then I did run some tests where I'd try =
something 2 or 3 ways, and run it 10,000 times to compare the elapsed =
time.</FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Courier New">I never compared this kind of =
calculation, howeer, as it was never the bottleneck.</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Courier New">I do know that, generally =
speaking, division is a slow operation.&nbsp; More important, though, in =
my opinion, is to make one's code visible, maintainable, and =
clonable.&nbsp;&nbsp; I respectfully disagree with you that using FLOOR =
+ division + multiplication (I'll call that 3 functions rather than 1) =
is a simplification over 2 data conversions and a substring.</FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Courier New">Benchmarking would be =
interesting, here, wouldn't it?&nbsp; Anyone want to try it out, on some =
different platforms?</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Courier New">Cordially,</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Courier New">David Morrison</FONT>
</P>
<BR>
<BR>

<P><FONT SIZE=3D2 FACE=3D"Courier New">&gt;-----Original =
Message-----</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;From: Robert Edis [<A =
HREF=3D"mailto:robeconsult@sbcglobal.net">mailto:robeconsult@sbcglobal.ne=
t</A>]</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;Sent: Tuesday, November 09, =
2004 1:55 PM</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;To: David Morrison - =
Corporate</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;Subject: RE: Beginning / End =
of week</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;This is interesting.&nbsp; =
David, why do you say that using</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;three functions is better =
than one?&nbsp; I have been using</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;FLOOR() to simplify logic =
rather than do data</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;conversions.</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;Do you have any benchmarks =
or a formulae to prove your</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;hypotheses?</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;Regards,</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;Blue</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Courier New">&gt;</FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C4C6B1.B0056588--