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 results to speed processing time #442

Open
clayreimann opened this issue Sep 21, 2016 · 5 comments
Open

Cache results to speed processing time #442

clayreimann opened this issue Sep 21, 2016 · 5 comments

Comments

@clayreimann
Copy link

Tailor Version: v0.10.1

Swift Version: N/A

Platform (Mac/Linux/Windows/CI): Mac

Installation Method: Homebrew

Steps to Reproduce Issue

  1. Add Taylor as a build step in XCode
  2. Build the project
  3. Build the project again

Expected Desired Behavior

In a perfect world the second build would be much faster than the first because nothing has changed, so we shouldn't need to analyze anything again.

Actual Behavior

Every run of tailor analyzes every file.

Potential Solutions

Caching information about the last run can be done in a number of ways, the easiest would be to tie the analysis results to the last modified time of the file. A higher-fidelity, but more expensive, method would be to cache the results against a hash of the file.

I'm willing to open a PR if this is something that the project would like.

@adityatrivedi
Copy link
Member

Hi @clayreimann!  We acknowledge that Tailor's analysis times for incremental builds can be significantly reduced by employing caching.  We are definitely open to contributions that would add this enhancement!

We would prefer this functionality to be implemented via a hashing algorithm, e.g. MD5 or SHA, see this SE answer for details.

Also, how would you approach storing the hashes and the analysis results? What are your thoughts on using SQLite to implement this?

@clayreimann
Copy link
Author

@adityatrivedi My initial thoughts on caching the results were just to cache the results (perhaps in json) in a file with the filename of the hash that it denoted. That would be the easiest way for other tools to have access to the parse results as well.

I'm not deeply opposed to using SQLite to store the cache. SQLite is nice in that there would only be one file produced as opposed to a directory, and reading the cached results back would likely be faster if they were stored in SQLite.

Thoughts?

@adityatrivedi
Copy link
Member

adityatrivedi commented Sep 23, 2016

@clayreimann After conferring with the team, we’ve reached quorum that SQLite is the most appropriate solution for storing the cache data, so hopefully we can pursue that option. Also, let’s try to use MD5 or a SHA variant for the hashing as recommended by the StackExchange answer we linked to.

We really appreciate you taking the time to get involved with Tailor! Please feel free to reach out to us here or on Gitter with your questions and ideas.

@clayreimann
Copy link
Author

Sorry for the long period with no update. We've decided to use swiftlint instead so this is no longer a priority for me.

@adityatrivedi
Copy link
Member

@clayreimann no worries! Thanks for the update.

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

2 participants