Speedup hint for users of viewcvs package

Peter Funk pf at artcom-gmbh.de
Fri Mar 30 13:57:35 EST 2001


Greg Stein has written a very useful Python application called viewcvs
which is availble at http://www.lyra.org/viewcvs/

Greg: if you read this: Thank you.  The following note applies to 
viewcvs version 0.6

I've installed it here in our company, because compared to cvsweb viewcvs
offers syntax colorized views of the source codes. 

But people complained, that viewcvs was a lot slower compared to cvsweb.cgi.
Fortunately this was really easy to fix:
 (1) go into the viewcvs installation directory and there into the
     sub directory cgi.  you need write permissions there. Example:
        # cd /usr/local/viewcvs-dev/cgi
 (2) Rename the file viewcvs.cgi to viewcvs.py:
        # mv viewcvs.cgi viewcvs.py
 (3) fire up the interactive Python interpreter, type 'import viewcvs'
     and leave it with Ctrl-D.
 (4) fix the permissions of the byte code file 'viewcvs.pyc' generated by
     step (3) to make it world readable.
 (5) Place the following snippet into a file viewcvs.cgi there:
	 #!/usr/bin/python
	 import sys, os
	 sys.path.insert(0, os.path.dirname(sys.argv[0]))
	 import viewcvs
     you may have to fix the path to your Python interpreter.
 (6) Try it from your web browser on your and you should be able to 
     observe speed pretty similar to cvsweb.

Explanation: viewcvs.cgi is a ~ 68 kB source file.  After applying the
procedure outlined above, this is compiled into a byte code file.
So there is no longer recompilation needed on each cgi request.

Regards, Peter
-- 
Peter Funk, Oldenburger Str.86, D-27777 Ganderkesee, Germany, Fax:+49 4222950260
office: +49 421 20419-0 (ArtCom GmbH, Grazer Str.8, D-28359 Bremen, Germany)





More information about the Python-list mailing list