Changes between Version 14 and Version 15 of PsycoMiddleware
- Timestamp:
- Jul 10, 2007, 5:02:27 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PsycoMiddleware
v14 v15 3 3 class PsycoMiddleware(object): 4 4 """ 5 This middleware enables the psyco extension module which can massively5 Enables the psyco extension module which can massively 6 6 speed up the execution of any Python code. 7 7 """ 8 8 9 def process_request(self, request): 9 10 try: … … 88 89 See http://psyco.sourceforge.net/psycoguide/node14.html for more information 89 90 90 Known problems: 91 Instead of throwing an exception when the platform is wrong, one could just not start psyco. 92 93 {{{ 94 import psyco 95 import platform 96 import re 97 98 if platform.architecture()[0] == '32bit': 99 psyco.cannotcompile(re.compile) # re.compile doesn't benefit from psyco 100 psyco.profile() # psyco.profile seems like the most sane choice. 101 102 # The middleware class definition is just here so django doesn't whine. 103 # Note also that we placed this class outside the if so that 104 # the middleware can be used without effect. 105 class PsycoMiddleware(object): 106 """ 107 Enables the psyco extension module which can massively 108 speed up the execution of any Python code. 109 """ 110 pass 111 }}} 112 113 = Known problems = 91 114 Psyco is great and you should look into it, but sometimes it can create weird problems (in conjunction with other software) that may be hard to debug. Please remember to turn it off when you have strange / not so obvious problems.