Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(87)

Issue 179110: Add SpamBayes performance test

Can't Edit
Can't Publish+Mail
Start Review
Created:
16 years, 6 months ago by Skip
Modified:
16 years, 6 months ago
CC:
unladen-swallow_googlegroups.com
Base URL:
http://unladen-swallow.googlecode.com/svn/tests/
Visibility:
Public.

Description

Here is a straightforward performance test using the SpamBayes tokenizer and its scoring machinery. This is my first attempt at writing a performance test so I'm a bit unclear on how much priming of the pump is needed.

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+18921 lines, -2 lines) Patch
M perf.py View 3 chunks +22 lines, -2 lines 0 comments Download
A performance/spambayes/bm_spambayes.py View 1 chunk +46 lines, -0 lines 2 comments Download
A performance/spambayes/hammie.pkl View Binary file 0 comments Download
A performance/spambayes/mailbox View 1 chunk +18853 lines, -0 lines 0 comments Download

Messages

Total messages: 7
Skip
PTAL
16 years, 6 months ago (2009-12-20 00:25:01 UTC) #1
alex.gaynor
A few things I spotted (warning 3 AM review). http://codereview.appspot.com/179110/diff/1/1002 File performance/spambayes/bm_spambayes.py (right): http://codereview.appspot.com/179110/diff/1/1002#newcode17 performance/spambayes/bm_spambayes.py:17: ...
16 years, 6 months ago (2009-12-20 08:44:14 UTC) #2
Skip
> Don't use your own computers paths. Understood. I couldn't tell how to get the ...
16 years, 6 months ago (2009-12-20 14:46:12 UTC) #3
Skip
> > You shouldn't need to run N times to prime it, one or two ...
16 years, 6 months ago (2009-12-20 16:29:00 UTC) #4
Collin Winter
I believe the hotness discrepancy is due to a bug at line 38 of bm_spambayes.py. ...
16 years, 6 months ago (2009-12-21 18:00:10 UTC) #5
Collin Winter
Committed as http://code.google.com/p/unladen-swallow/source/detail?r=945 I reduced the amount of pump-priming because I think the the lower ...
16 years, 6 months ago (2009-12-21 19:48:41 UTC) #6
skip_pobox.com
16 years, 6 months ago (2009-12-22 00:43:08 UTC) #7
    Collin> I believe the hotness discrepancy is due to a bug at line 38 of
    Collin> bm_spambayes.py. I'll fix that.

Well, that was dumb.  It's not the whole story though.  After fixing that
bug here's my pump primer:

    for _ in xrange(N):
        for msg in msgs:
            ntokens = len(list(tokenize(msg)))
            score = h.score(msg)

where I simply change N to suit: 1, 5, iterations, etc.

If N == 1:

    Min: 0.854196 -> 0.699381: 1.2214x faster
    Avg: 0.860160 -> 0.920951: 1.0707x slower
    Not significant
    Stddev: 0.01476 -> 0.64805: 43.9011x larger

If N == 5:

    Min: 0.855203 -> 0.693278: 1.2336x faster
    Avg: 0.858933 -> 0.797368: 1.0772x faster
    Not significant
    Stddev: 0.00783 -> 0.23453: 29.9475x larger

If N == iterations:

    Min: 0.853942 -> 0.694206: 1.2301x faster
    Avg: 0.857288 -> 0.708853: 1.2094x faster
    Significant (t=22.599881, a=0.95)
    Stddev: 0.00296 -> 0.04635: 15.6742x larger

So my assertion still stands.  Executing the key SpamBayes functions once is
not sufficient to mark them "hot".

Skip
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b