tailor icon indicating copy to clipboard operation
tailor copied to clipboard

Cache results to speed processing time

Open clayreimann opened this issue 8 years ago • 5 comments

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.

clayreimann avatar Sep 21 '16 03:09 clayreimann

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?

adityatrivedi avatar Sep 22 '16 07:09 adityatrivedi

@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?

clayreimann avatar Sep 22 '16 22:09 clayreimann

@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.

adityatrivedi avatar Sep 23 '16 06:09 adityatrivedi

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

clayreimann avatar Dec 20 '16 19:12 clayreimann

@clayreimann no worries! Thanks for the update.

adityatrivedi avatar Jan 05 '17 05:01 adityatrivedi