Re: weblogsping.py error handling patch

"Blake Winton" <blake-dlUKtbW3TlBcVw/[email protected]>
Newsgroups gmane.comp.web.pyblosxom.devel
Message-ID <[email protected]>
> Correct me if I'm wrong, but I think the email at that link 
> is talking about type checking versus using a try/except 
> block as opposed to using a try/except block versus not using one.

It is, which is why I included my code...

> What version of Python are you using?  I'm using Python 2.3 
> on an ibook G4 (800 mhz) with Mac OS 10.3 and I get:
>     10000 took 7.8344 seconds
>     10000 took 10.9729 seconds

Pythonwin on a Dell PentiumD (2.8 GHz dual-core).

On my OSX box (Mac Mini, Dual Core):
10000 took 1.7110 seconds
10000 took 2.4135 seconds

(The 10 times as many run was:
 10000 took 17.0197 seconds
 10000 took 23.6113 seconds
 to the surprise of no-one.)

Either way, it's all close to the same factor of slowness:
>>> 10.9729/7.8344
1.4006050239967325
>>> 1.7450/1.2830
1.3600935307872177
>>> 13.6610/9.5540
1.4298723047938036

So raising an exception is approximately 1.4 times slower than
doing an addition...  I still don't think that's too slow.

> with the code you posted.  That seems pretty significant to 
> me.  We use callbacks in a few places where the runtime is 
> O(n) where n is the number of blog entries you have.  If you 
> have several plugins on the same callback, then that becomse 
> O(m * n) where m is the number of plugins and n is the number 
> of entries, though m is likely < 10.
> 
> Does that sound right?

I'ld buy your math, but I'ld love to see some actual numbers.  I've
got 280 posts, and 16 plugins, for a total of 4480.  Does anyone
have any better numbers?  Will, would you like to re-run my tests
with some more realistic values?  (Say 20 plugins, and 10,000
entries?  25 plugins and 5,000 entries?)

I guess my point is that even at 3 seconds, you're talking about
20 plugins and 500,000 entries.  So if it scales linearly you're
looking at a 0.06 second slowdown for 20 plugins and 10,000 entries;
0.75 seconds for 25 plugins and 10,000 entries; and so on...

Hmm, maybe what I'm trying to say is:
We should run some benchmarks before and after the change, and see
if the actual implementation is too slow.

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.