Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Computed properties are computed twice #128

Open
mostafah opened this Issue · 1 comment

1 participant

@mostafah

Rendering template {{something}}{{^something}}nothing{{/something}} will call something twice when it’s a function. This is such a common pattern, so keeping the returned value can lead to a significant performance increase, specially when something returns a list, or when it’s not very cheap and is called for every item in a list.

This doesn’t have to be implemented as a full caching mechanism. For covering this pattern keeping the return value only for a single scope or even only for the next expression in the current scope would suffice.

I’m new to Mustache and maybe I’m missing something here. But anyways I thought hogan might be interested in this improvement because of its focus on speed.

@mostafah

If you are liking this suggestion, I can go ahead and see what I can do about it in a pull request. I’m not familiar with the codebase, but I’ll go and see what I can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.