The reason why I had looked at that example first was the fact it was
the first TG code listed. Anyway I looked into the issue a little
deeper and I realized now it will not effect start up time but felt it
was still worth optimizing. I found that there were some indentation
via tabs which added some overhead but didn't cause any errors even
though the code was not executing as intended and I could use list
comprehension to remove the lambda. Anyway the function is now 100
times faster with this change and should allow TG to increase the
number of pages it can serve per second.
The while loop in reloader_thread should become
while cherrypy.lib.autoreload.RUN_RELOADER:
if package:
modlist = [module for modname, module in
sys.modules.items() if modname.startswith(package)]
else:
modlist = map( archive_selector, sys.modules.values())
for filename in filter(lambda v: v, map(lambda m: getattr(m,
"__file__", None), modlist)):
if filename.endswith(".kid") or filename == "<string>":
continue
orig_filename = filename
if filename.endswith(".pyc"):
filename = filename[:-1]
try:
mtime = os.stat(filename).st_mtime
except OSError, e:
if orig_filename.endswith('.pyc') and e[0] ==
errno.ENOENT:
# This prevents us from endlessly restarting if
there is an old .pyc lying around
# after a .py file has been deleted
try: os.unlink(orig_filename)
except: pass
sys.exit(3) # force reload
if filename not in mtimes:
mtimes[filename] = mtime
continue
if mtime > mtimes[filename]:
sys.exit(3) # force reload
time.sleep(freq)
I'll create a patch for this and create a ticket when I'm on a computer
that has SVN access.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---