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

Improve sdf generation performance #17

Merged
merged 2 commits into from
Sep 29, 2016

Conversation

basicNew
Copy link
Contributor

@basicNew basicNew commented Sep 29, 2016

Fixes #12

Basically just caching the Jinja template so it doesn't need to parse it over and over. Time has drastically changed:

$ time terminus/run_generator.py --builder=ProceduralCityBuilder --destination=hey.world --parameters filename=../procedural_city_generation/procedural_city_generation/temp/mycity

Before:

real 0m11.854s
user 0m11.768s
sys  0m0.024s

After:

real 0m0.464s
user 0m0.408s
sys  0m0.052s

@ernestmc @garyservin the only important thing to remember is that now the template() method lives on the class side, so you should define it like:

    @classmethod
    def template(cls):
        ...

If we happen to need to redefine the template at the instance level (can't think why, but in any case) you can just override the instance method jinja_template(self). You will however loose the caching.

@garyservin garyservin merged commit d3b8cc1 into master Sep 29, 2016
@basicNew basicNew deleted the Issue#12-ImproveGenerationPerformance branch January 12, 2017 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants