[Charlotte.PM] Help me tune this for speed

drewhead@drewhead.org drewhead at drewhead.org
Wed Jul 27 11:29:53 PDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> On Wed, Jul 27, 2005 at 01:02:27PM -0400, William McKee wrote:
> > Basically, it looks like most of the time in the script is spent in
> > Math::Geometry::Planar. Even using Steven's version of the code, I still
> > see much the same results. It looks like you need to look at ways to
> > limit the calls to SegmentIntersection() or improve the algorithms in
> > Math::Geometry::Planar::SegmentIntersection.

> After a little more exploration, we realized that the first call to
> SegmentIntersection is unnecessary. Removing that call dropped the
> calculation time in half and similarly improved the profile output from
> dprofpp.  Steven suggests looking at Ch 7 of _Perl Objects, References,
> and Modules_. Our invoice is in the mail :).

Doh!  Drew left in Debug code! that first call shouldn't have been there.
I've choped this thing to bits so much over the last 10 days I've
forgotton what's real and whats in there 'just to see'.  Yes, that would
make things run longer, removing it unfortuantly doesn't solve my scale problem. 

However... the link and hints about profiling are pure gold.  Cool!  I
never knew that was out there.  Learning of these is worth the price of
the OP.  I'm being vacated for 48 hours by my family starting tomorow.
Guess what I'll be sitting in my basement doing.  :)

Given that the intersection math seems to be where time was spent,
something I had discounted given my own [incorrect] tests, then I suppose
that I need to investigate one of the Math modules to improve upon
performance, or resign to farming this out to C code (as was orginally
sugested by the guy that came up with the algorithm.)  There is another
algorithm that uses triangles that we think is O(N log N) but it's quite a
bit more complex and we're still working on making it function.  :)

- -- 
     Drew Dowling               Drewhead          http://www.drewhead.org
 drewhead at drewhead.org    |                    |    WWW      / \ Alpha Phi Omega
Concord, North Carolina   |                    |  Nimat     /   \  Gamma Lambda
CLEMSON UNIVERSITY ALUMNI |                    | Apatschin /_____\
      TIGER BAND!         |      VGAP4 Hosting at http://vgap.drewhead.org
-----BEGIN PGP SIGNATURE-----
Comment: Public key available at http://www.drewhead.org

iD8DBQFC59KV8J7U7yHE638RAnjFAJ93ebSpbAaD/g4AYzdNrd2EHwZfuwCghi4P
ijvvghiCfRQ61rRpoeu3CTY=
=kpzt
-----END PGP SIGNATURE-----


More information about the charlotte mailing list