Re: weblogsping.py error handling patch
"Blake Winton" <blake-dlUKtbW3TlBcVw/[email protected]>
| Newsgroups | gmane.comp.web.pyblosxom.devel |
|---|---|
| Message-ID | <[email protected]> |
(I was going to send this just to Will, because I don't think
any of the rest of you care, but then I ran the profiler, and
so I'm going to send it to the list as well, in the hopes that
someone wants to take the profiled data and do something with
it.)
> On Tue, 29 Aug 2006, Blake Winton wrote:
> > So raising an exception is approximately 1.4 times slower
> > than doing an addition... I still don't think that's too slow.
> I disagree. I think a factor of 1.4 is a big deal.
But wait, it's only 1.4 times slower to do an addition and a
try than just an addition, so just the try block runs at 0.4
times the speed of an addition. It would be cheaper for us
to add a try block than it would to add a "+"... I agree that
a factor of 1.4 slowdown for the whole app would be a big deal,
but that's not what was being timed there.
Anyways, as you mention, this is all beside the point...
> I think we both agree that it does cause a performance
> degradation and that's all I was saying. You say 1.4 times
> isn't a big deal, but I think it is a big deal. So there we
> differ in opinion. Profiling PyBlosxom is a good idea and I
> think it's one of the TODO items if someone is interested in
> doing some optimization work.
It _would_ be nice to see some profiling. To that end, I've
ran pyblosxom.cgi through the Python profiler, and am attaching
the stats I got. To use it, fire up Python, import pstats,
and follow the directions here:
s = pstats.Stats( "pyblosxom.stats" )
s.sort_stats( "cumulative", "nfl" )
s.print_stats( 20 )
For more information, see:
http://docs.python.org/lib/profile-stats.html
The stats I've attached are for a single hit to the root of
my blog. To replicate this with your config, edit pyblosxom.cgi
and put everything after:
from Pyblosxom.pyblosxom import PyBlosxom
into a main method, then add these lines at the bottom:
if __name__ == '__main__':
temp = tempfile.mktemp( prefix='pyblosxom_' )
profile.run( "main()", temp )
# To run it normally, comment out the above lines,
# and uncomment the following line.
#main()
Hopefully someone can take my stats, or stats of their own,
and we can see where PyBlosxom really is slow...
> Regardless, that's not my main issue with the change.
I didn't think that particularly was, and I agree that the
change shouldn't go in as it is, but I did want to try to
correct the misassumption that try blocks are slow. They
really aren't. It's creating and throwing the exceptions
that's the slow part.
Later,
Blake.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642