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

Cache ScopeKeyData #158

Open
phillipskevin opened this issue Apr 20, 2018 · 1 comment
Open

Cache ScopeKeyData #158

phillipskevin opened this issue Apr 20, 2018 · 1 comment

Comments

@phillipskevin
Copy link
Contributor

phillipskevin commented Apr 20, 2018

Currently, each time a property from the scope is used, a new ScopeKeyData is created. Here is the graph of a relatively simple page (http://www.place-my-order.com/restaurants). Each of the items in an orange box is a different ScopeKeyData for "state":

image

Is there any reason we can't cache these? cc @justinbmeyer

Here is an example of what this would look like:

image

The code for this is on here.

@justinbmeyer
Copy link
Contributor

We do here: https://github.com/canjs/can-stache/blob/master/src/mustache_core.js#L245

I tried doing it elsewhere and I remember there being problems.

Perhaps there won't be anymore. You'd have to make sure all values to ScopeKeyData(scope, key, options) are the same.

You could probably use KeyTree to make the caching code a bit smaller.

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

No branches or pull requests

2 participants