tailor
tailor copied to clipboard
Cache results to speed processing time
Tailor Version: v0.10.1
Swift Version: N/A
Platform (Mac/Linux/Windows/CI): Mac
Installation Method: Homebrew
Steps to Reproduce Issue
- Add Taylor as a build step in XCode
- Build the project
- 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.
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 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 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.
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 no worries! Thanks for the update.