diff options
author | R. Tyler Ballance <tyler@slide.com> | 2009-06-27 15:32:28 +0800 |
---|---|---|
committer | James Abbatiello <abbeyj@gmail.com> | 2009-06-28 12:17:38 +0800 |
commit | 4df5cb55c93c3db952e35da2523471e4f4ec8cc0 (patch) | |
tree | 9a46d6de58220da34db3bd5ab64f53aa7979d77b | |
parent | 8bee5af2e355e78e28b9a2f6a86009bbf01aa654 (diff) | |
download | python-cheetah-4df5cb55c93c3db952e35da2523471e4f4ec8cc0.tar.gz |
Add two new tests to evaluate performance of Template.compile()
Results being tracked in this gist:
http://gist.github.com/136936
Signed-off-by: James Abbatiello <abbeyj@gmail.com>
-rw-r--r-- | src/Tests/Performance.py | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/Tests/Performance.py b/src/Tests/Performance.py index 723f251..c74e4c3 100644 --- a/src/Tests/Performance.py +++ b/src/Tests/Performance.py @@ -152,6 +152,58 @@ class FilterTest(PerformanceTest): def performanceSample(self): value = unicode(self.template) + +class LongCompileTest(PerformanceTest): + ''' Test the compilation on a sufficiently large template ''' + def compile(self, template): + return Cheetah.Template.Template.compile(template, keepRefToGeneratedCode=False) + + def performanceSample(self): + template = ''' + #import sys + #import Cheetah.Template + + #extends Cheetah.Template.Template + + #def header() + <center><h2>This is my header</h2></center> + #end def + + #def footer() + #return "Huzzah" + #end def + + #def scripts() + #pass + #end def + + #def respond() + <html> + <head> + <title>${title}</title> + + $scripts() + </head> + <body> + $header() + + This is just some stupid page! + + <br/> + $footer() + </body> + </html> + #end def + + ''' + template = self.compile(template) + +class LongCompile_CompilerSettingsTest(LongCompileTest): + def compile(self, template): + return Cheetah.Template.Template.compile(template, keepRefToGeneratedCode=False, + compilerSettings={'useStackFrames' : True, 'useAutocalling' : True}) + + if __name__ == '__main__': if '--debug' in sys.argv: DEBUG = True |