Compiling templates should not be performance problem because it is
done only once at the beginning. If it is recompiling the templates
every time, then there is something wrong with your settings.
What is the version of web.py that you are using? Can you provide a
sample template that is failing?
--
You received this message because you are subscribed to the Google Groups "web.py" group.
To post to this group, send email to we...@googlegroups.com.
To unsubscribe from this group, send email to webpy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
Try changing it to:
def render_hook():
cookies = web.cookies(lang="en")
lang = cookies.lang
if lang not in settings.VALID_LANGS:
lang = "en"
web.ctx.render = getattr(render, lang)
render = web.template.render(settings.TEMPLATES_PATH)
took 0.402858018875 seconds+++
71906 function calls (41723 primitive calls) in 0.403 CPU seconds
Ordered by: internal time, call count
List reduced from 437 to 40 due to restriction <40>
ncalls tottime percall cumtime percall filename:lineno(function)
5703/342 0.041 0.000 0.239 0.001 transformer.py:1060(com_binary)
8597/4 0.036 0.000 0.277 0.069 transformer.py:787(com_node)
6484/677 0.033 0.000 0.033 0.000 transformer.py:73(extractLineNo)
2447/2 0.030 0.000 0.048 0.024 template.py:1115(visit)
709 0.020 0.000 0.022 0.000 transformer.py:751(decode_literal)
8806 0.017 0.000 0.017 0.000 transformer.py:784(lookup_node)
1074/678 0.009 0.000 0.148 0.000 transformer.py:699(factor)
1018/2 0.008 0.000 0.278 0.139 transformer.py:1072(com_stmt)
1074/678 0.008 0.000 0.142 0.000 transformer.py:712(power)
2 0.007 0.004 0.285 0.143 transformer.py:121(transform)
709 0.007 0.000 0.030 0.000 transformer.py:762(atom_string)
2 0.007 0.003 0.375 0.188 template.py:862(compile_template)
2 0.006 0.003 0.291 0.146 transformer.py:127(parsesuite)
455 0.006 0.000 0.008 0.000 application.py:605(check)
342/336 0.006 0.000 0.112 0.000 transformer.py:1209(com_call_function)
1074/678 0.006 0.000 0.155 0.000 transformer.py:681(term)
1072/676 0.006 0.000 0.227 0.000 transformer.py:579(test)
1074/678 0.005 0.000 0.161 0.000 transformer.py:669(arith_expr)
1074/678 0.005 0.000 0.167 0.000 transformer.py:656(shift_expr)
676/2 0.005 0.000 0.278 0.139 transformer.py:1079(com_append_stmt)
1072/676 0.005 0.000 0.221 0.000 transformer.py:593(or_test)
1074/677 0.005 0.000 0.203 0.000 transformer.py:604(not_test)
1073/677 0.005 0.000 0.198 0.000 transformer.py:611(comparison)
1072/676 0.004 0.000 0.212 0.000 transformer.py:600(and_test)
2447 0.004 0.000 0.004 0.000 template.py:1117(classname)
1074/678 0.004 0.000 0.176 0.000 transformer.py:652(and_expr)
1074/678 0.004 0.000 0.184 0.000 transformer.py:648(xor_expr)
1074/1071 0.004 0.000 0.038 0.000 transformer.py:725(atom)
1074/678 0.004 0.000 0.192 0.000 transformer.py:644(expr)
1018/2 0.004 0.000 0.278 0.139 transformer.py:305(stmt)
334 0.004 0.000 0.266 0.001 transformer.py:312(simple_stmt)
698 0.004 0.000 0.006 0.000 ast.py:18(flatten_nodes)
334 0.003 0.000 0.011 0.000 template.py:167(readline)
703/698 0.003 0.000 0.003 0.000 ast.py:7(flatten)
334 0.003 0.000 0.243 0.001 transformer.py:410(yield_expr)
334 0.002 0.000 0.248 0.001 transformer.py:406(yield_stmt)
341/312 0.002 0.000 0.017 0.000 template.py:86(read_section)
361 0.002 0.000 0.003 0.000 transformer.py:768(atom_name)
378/377 0.002 0.000 0.004 0.000 utils.py:217(safeunicode)
334 0.002 0.000 0.003 0.000 template.py:558(emit)
--
took 0.0281779766083 seconds
2826 function calls (2809 primitive calls) in 0.028 CPU seconds
Ordered by: internal time, call count
List reduced from 96 to 40 due to restriction <40>
--
Did you run this test using dev server? If so, try again after setting
web.config.debug = False.
--
To unsubscribe from this group, send email to webpy+un...@googlegroups.com.