From: Bernardo Innocenti Date: Sun, 23 Sep 2007 07:42:52 +0000 (+0200) Subject: Add benchmark. X-Git-Tag: v3.0~60 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=9ba86215f478f6ec624522d42e9aeb9f1eb9eb30;p=geekigeeki.git Add benchmark. --- diff --git a/geekigeeki.py b/geekigeeki.py index a0345ee..ad4fc5d 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -17,9 +17,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -__version__ = '$Id$'[4:-2] +__version__ = '$Id$'[4:12] -import cgi, sys, string, os, re, errno, time, stat +from time import clock +start_time = clock() + +import cgi, sys, string, os, re, errno, stat from os import path, environ # Regular expression defining a WikiWord @@ -190,7 +193,6 @@ def do_fullsearch(needle): print_search_stats(len(hits), len(all_pages)) - def do_titlesearch(needle): # TODO: check needle is legal -- but probably we can just accept any RE send_title(None, "Title search for \"" + needle + '"') @@ -206,7 +208,6 @@ def do_titlesearch(needle): print_search_stats(len(hits), len(all_pages)) - def print_search_stats(hits, searched): print "

%d hits out of %d pages searched.

" % (hits, searched) @@ -239,11 +240,9 @@ def make_index_key(): s = s + '

' return s - def page_list(): return filter(word_re.match, os.listdir(text_dir)) - def send_footer(name, mod_string=None): if debug_cgi: cgi.print_arguments() @@ -251,14 +250,13 @@ def send_footer(name, mod_string=None): cgi.print_environ() global __version__ print '' - # ---------------------------------------------------------- # Macros def _macro_TitleSearch(*vargs):