optimize some code paths

Optimized some codepaths within the lexer/Python code generation process,
improving performance for generation of templates prior to their being
cached. Pull request courtesy Takuto Ikuta.

This shows around 10% performance improvement in our use case (https://crbug.com/1214033#c32).

Closes: #361
Pull-request: https://github.com/sqlalchemy/mako/pull/361
Pull-request-sha: bcdee5ccf57100490aa0e48baeda6f15b584ab32

Change-Id: If647f77a52d5745019dcc46f82fd7a928f990757
3 files changed