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

Problems with the current "asset dependencies" approach #443

Open
mpdude opened this issue Jun 4, 2013 · 5 comments
Open

Problems with the current "asset dependencies" approach #443

mpdude opened this issue Jun 4, 2013 · 5 comments

Comments

@mpdude
Copy link
Contributor

mpdude commented Jun 4, 2013

As of #362 we've got the possibility for filters to implement a particular interface for deep dependency extraction. If they do, they are presented the Assets' contents (in the state before they are applied) and can then return new Assets to indicate additional files that are relevant when it comes to re-generating/re-processing stuff.

Currently, these new Assets are just used to calculate a single "all dependencies included" last-modified-timestamp.

Problems with that:

  • If more than one filter is applied and dependency-aware, all previous filters need to be run repeatedly to have the right input for filters at the end of the chain
  • The "deep mtime" cannot reasonably be used for cache validation as it might be expensive to calculate (scanning Assets for "deep deps" is one thing; but it might also lead to executing filters)

I think we should focus on the second one. If we fix that, the first one is just some penalty incurred when we initially generate stuff and cache it.

One solution might be something similar to Symfony's ConfigCache - we need to "deep extract" the depended-on Assets (or files, or globs, or whatever). The next time we come back to validate a set of processed assets, we look at that list and mtimes and not use the extraction process again.

@kriswallsmith Please correct me if I am getting facts wrong.

@kriswallsmith
Copy link
Owner

I agree there is plenty of room for caching here.

@mpdude
Copy link
Contributor Author

mpdude commented Jun 4, 2013

So before we start tweaking the deep mtime too much here, maybe we should try to get it as good as possible in AsseticBundle and have only the minimum support necessary in Assetic itself?

That way we might be able to leverage the ConfigCache.

@demonkoryu
Copy link

@mpdude Think of us poor ZF2 users.

@kriswallsmith
Copy link
Owner

@demonkoryu don't worry, this work will be done here

@mpdude
Copy link
Contributor Author

mpdude commented Jun 5, 2013

If we had a helper class that collects the "deep" assets, maybe one could serialize and keep that for later requests. It would then be used to re-iterate those assets, check their last modified again and return whether or not one changed. If so, re-generate stuff as usual.

That way, users only need to somehow keep one object and query it before they do the expensive stuff.

Thoughts? I don't want to slip into re-inventing sf2's ConfigCache here.

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

3 participants