Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize Namespace #156

Closed
sqlalchemy-bot opened this issue Nov 13, 2010 · 2 comments
Closed

optimize Namespace #156

sqlalchemy-bot opened this issue Nov 13, 2010 · 2 comments

Comments

@sqlalchemy-bot
Copy link

Migrated issue, originally created by Michael Bayer (@zzzeek)

its time to get around to this.

  1. the "file" and "module" arguments to <%namespace> become mutually exclusive. one or the other.

  2. Namespace breaks into TemplateNamespace, ModuleNamespace, and Namespace which still is used if there's no template or module.

  3. __getattr__ can now be broken down to not require the "has_def()" and "hasattr()" calls, just catch attributeerror and re-raise.

  4. more importantly, __getattr__ should put the resolved method into __dict__.

  5. when we do the lambda *args, **kwargs:callable_(context, *args, **kwargs), lets use functools.partial . its native

  6. inline _get_star(), plus the partial, should speed it up a bit

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

the above more or less in 717d8a8 cff8367 cb9ebd2. can't really lose the has_def() and hasattr() calls. some runsnakerun profiling revealed the biggest hit as not using StringIO anymore (4737c26) and to get rid of that builtin copy (6c06a32). we're within 10% of jinja2 in that particular test now.

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant