Skip to content

Commit 92fd8ce

Browse files
author
Richard Jones
committed
some speedups, some fixes to the benchmarking
1 parent eaa8081 commit 92fd8ce

File tree

9 files changed

+75
-39
lines changed

9 files changed

+75
-39
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ are given with the most recent entry first.
1919
- sf 611217 ] menu() has problems when labelprop==None
2020
- verify contents of tracker module when the tracker is opened
2121
- performance improvements in *dbm and sq backends
22+
- mailgw was missing an "import sys"
2223

2324
2002-09-13 0.5.0 beta2
2425
. all backends now have a .close() method, and it's used everywhere

TODO.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,5 @@ pending web allow multilink selections to select a "none" element to allow
5252

5353
bug mailgw some f*ked mailers QUOTE their Re; "Re: "[issue1] bla blah""
5454
bug docs need to mention somewhere how sorting works
55-
bug web :multilink isn't working
56-
bug docs mention not putting spaces in tracker URL aliases
5755
======= ========= =============================================================
5856

cgi-bin/roundup.cgi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818
#
19-
# $Id: roundup.cgi,v 1.32 2002-09-16 22:37:26 richard Exp $
19+
# $Id: roundup.cgi,v 1.33 2002-09-23 00:50:32 richard Exp $
2020

2121
# python version check
2222
from roundup import version_check
@@ -36,6 +36,9 @@ import sys
3636
# "NAME=DIR<sep>NAME2=DIR2<sep>...", where <sep> is the directory path
3737
# separator (";" on Windows, ":" on Unix).
3838

39+
# Make sure the NAME part doesn't include any url-unsafe characters like
40+
# spaces, as these confuse the cookie handling in browsers like IE.
41+
3942
# ROUNDUP_LOG is the name of the logfile; if it's empty or does not exist,
4043
# logging is turned off (unless you changed the default below).
4144

roundup/backends/back_anydbm.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_anydbm.py,v 1.83 2002-09-20 05:08:00 richard Exp $
18+
#$Id: back_anydbm.py,v 1.84 2002-09-23 00:50:32 richard Exp $
1919
'''
2020
This module defines a backend that saves the hyperdatabase in a database
2121
chosen by anydbm. It is guaranteed to always be available in python
@@ -593,6 +593,9 @@ def commit(self):
593593
# save the indexer state
594594
self.indexer.save_index()
595595

596+
self.clearCache()
597+
598+
def clearCache(self):
596599
# all transactions committed, back to normal
597600
self.cache = {}
598601
self.dirtynodes = {}

roundup/backends/rdbms_common.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: rdbms_common.py,v 1.9 2002-09-20 05:08:00 richard Exp $
1+
# $Id: rdbms_common.py,v 1.10 2002-09-23 00:50:32 richard Exp $
22

33
# standard python modules
44
import sys, os, time, re, errno, weakref, copy
@@ -44,6 +44,10 @@ def __init__(self, config, journaltag=None):
4444
# open a connection to the database, creating the "conn" attribute
4545
self.open_connection()
4646

47+
def clearCache(self):
48+
self.cache = {}
49+
self.cache_lru = []
50+
4751
def open_connection(self):
4852
''' Open a connection to the database, creating it if necessary
4953
'''

roundup/cgi/PageTemplates/Expressions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
2626
"""
2727

28-
__version__='$Revision: 1.6 $'[11:-2]
28+
__version__='$Revision: 1.7 $'[11:-2]
2929

3030
import re, sys
3131
from TALES import Engine, CompilerError, _valid_name, NAME_RE, \
@@ -288,9 +288,9 @@ def restrictedTraverse(self, path, securityManager,
288288
name = path.pop()
289289
__traceback_info__ = TraversalError(done, name)
290290

291-
if isinstance(name, TupleType):
292-
object = apply(object, name)
293-
continue
291+
# if isinstance(name, TupleType):
292+
# object = apply(object, name)
293+
# continue
294294

295295
# if name[0] == '_':
296296
# # Never allowed in a URL.

roundup/scripts/roundup_server.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#
1717
""" HTTP Server that serves roundup.
1818
19-
$Id: roundup_server.py,v 1.10 2002-09-10 03:01:19 richard Exp $
19+
$Id: roundup_server.py,v 1.11 2002-09-23 00:50:32 richard Exp $
2020
"""
2121

2222
# python version check
@@ -34,7 +34,11 @@
3434
## Configuration
3535
#
3636

37-
# This indicates where the Roundup instance lives
37+
# This indicates where the Roundup trackers live. They're given as NAME ->
38+
# TRACKER_HOME, where the NAME part is used in the URL to select the
39+
# appropriate reacker.
40+
# Make sure the NAME part doesn't include any url-unsafe characters like
41+
# spaces, as these confuse the cookie handling in browsers like IE.
3842
TRACKER_HOMES = {
3943
'bar': '/tmp/bar',
4044
}
@@ -182,6 +186,8 @@ def usage(message=''):
182186
"roundup-admin init". You may specify any number of these name=home
183187
pairs on the command-line. For convenience, you may edit the
184188
TRACKER_HOMES variable in the roundup-server file instead.
189+
Make sure the name part doesn't include any url-unsafe characters like
190+
spaces, as these confuse the cookie handling in browsers like IE.
185191
''')%locals()
186192
sys.exit(0)
187193

roundup/templates/classic/html/file.item

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ You are not allowed to view this page.
88
<input type="hidden" name=":template" value="item">
99
<input type="hidden" name=":required" value="name,type">
1010

11-
<input type="hidden" name="multilink"
11+
<input type="hidden" name=":multilink"
1212
tal:condition="python:request.form.has_key(':multilink')"
1313
tal:attributes="value request/form/:multilink/value">
1414

test/benchmark.py

Lines changed: 48 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,10 @@ def setupSchema(db, module):
1919
session = module.Class(db, 'session', title=String())
2020
session.disableJournalling()
2121
db.post_init()
22-
status.create(name="unread")
23-
status.create(name="in-progress")
24-
status.create(name="testing")
25-
status.create(name="resolved")
26-
user.create(username='one')
27-
user.create(username='two')
2822
db.commit()
2923

3024
class config:
31-
DATABASE='_test_dir'
25+
DATABASE='_benchmark'
3226
GADFLY_DATABASE = ('test', DATABASE)
3327
MAILHOST = 'localhost'
3428
MAIL_DOMAIN = 'fill.me.in.'
@@ -48,56 +42,83 @@ def main(backendname, time=time.time, numissues=10):
4842
except ImportError:
4943
return
5044

51-
if os.path.exists(config.DATABASE):
52-
shutil.rmtree(config.DATABASE)
53-
5445
times = []
55-
db = backend.Database(config, 'test')
56-
setupSchema(db, backend)
5746

58-
# create a whole bunch of stuff
59-
for i in range(numissues):
60-
db.issue.create(**{'title': 'issue %s'%i})
61-
for j in range(10):
62-
db.issue.set(str(i+1), status='2', assignedto='2', nosy=[])
63-
db.issue.set(str(i+1), status='1', assignedto='1', nosy=['1','2'])
64-
db.user.create(**{'username': 'user %s'%i})
65-
for j in range(10):
66-
db.user.set(str(i+1), assignable=1)
67-
db.user.set(str(i+1), assignable=0)
68-
db.commit()
47+
config.DATABASE = os.path.join('_benchmark', '%s-%s'%(backendname,
48+
numissues))
49+
if not os.path.exists(config.DATABASE):
50+
db = backend.Database(config, 'admin')
51+
setupSchema(db, backend)
52+
# create a whole bunch of stuff
53+
db.user.create(**{'username': 'admin'})
54+
db.status.create(name="unread")
55+
db.status.create(name="in-progress")
56+
db.status.create(name="testing")
57+
db.status.create(name="resolved")
58+
pc = -1
59+
for i in range(numissues):
60+
db.user.create(**{'username': 'user %s'%i})
61+
for j in range(10):
62+
db.user.set(str(i+1), assignable=1)
63+
db.user.set(str(i+1), assignable=0)
64+
db.issue.create(**{'title': 'issue %s'%i})
65+
for j in range(10):
66+
db.issue.set(str(i+1), status='2', assignedto='2', nosy=[])
67+
db.issue.set(str(i+1), status='1', assignedto='1',
68+
nosy=['1','2'])
69+
if (i*100/numissues) != pc:
70+
pc = (i*100/numissues)
71+
sys.stdout.write("%d%%\r"%pc)
72+
sys.stdout.flush()
73+
db.commit()
74+
else:
75+
db = backend.Database(config, 'admin')
76+
setupSchema(db, backend)
77+
6978
sys.stdout.write('%7s: %-6d'%(backendname, numissues))
7079
sys.stdout.flush()
7180

7281
times.append(('start', time()))
7382

7483
# fetch
84+
db.clearCache()
7585
for i in db.issue.list():
7686
db.issue.get(i, 'title')
7787
times.append(('fetch', time()))
7888

7989
# journals
90+
db.clearCache()
8091
for i in db.issue.list():
8192
db.issue.history(i)
8293
times.append(('journal', time()))
8394

8495
# "calculated" props
96+
db.clearCache()
8597
for i in db.issue.list():
8698
db.issue.get(i, 'activity')
8799
db.issue.get(i, 'creator')
88100
db.issue.get(i, 'creation')
89101
times.append(('jprops', time()))
90102

91103
# lookup
104+
db.clearCache()
92105
for i in range(numissues):
93106
db.user.lookup('user %s'%i)
94107
times.append(('lookup', time()))
95108

96109
# filter
110+
db.clearCache()
111+
for i in range(100):
112+
db.issue.filter(None, {'assignedto': '1', 'title':'issue'},
113+
('+', 'activity'), ('+', 'status'))
114+
times.append(('filter', time()))
115+
116+
# filter with multilink
117+
db.clearCache()
97118
for i in range(100):
98119
db.issue.filter(None, {'nosy': ['1'], 'assignedto': '1',
99120
'title':'issue'}, ('+', 'activity'), ('+', 'status'))
100-
times.append(('filter', time()))
121+
times.append(('filtml', time()))
101122

102123
# results
103124
last = None
@@ -113,11 +134,11 @@ def main(backendname, time=time.time, numissues=10):
113134
if __name__ == '__main__':
114135
# 0 1 2 3 4 5 6
115136
# 01234567890123456789012345678901234567890123456789012345678901234
116-
print 'Test name fetch journl jprops lookup filter TOTAL '
137+
print 'Test name fetch journl jprops lookup filter filtml TOTAL '
117138
for name in 'anydbm bsddb bsddb3 metakit sqlite'.split():
118139
main(name)
119140
for name in 'anydbm bsddb bsddb3 metakit sqlite'.split():
120141
main(name, numissues=20)
121-
# for name in 'anydbm bsddb bsddb3 metakit sqlite'.split():
122-
# main(name, numissues=100)
142+
for name in 'anydbm bsddb bsddb3 metakit sqlite'.split():
143+
main(name, numissues=100)
123144

0 commit comments

Comments
 (0)