v0.3.0.0
Performance Improvements
This release includes a couple hefty performance increases, one of which drastically reduces fingerprinting of directories to determine cache read viability. With this in place, caching is now re-enabled by default. 🎉
The nitty-gritty: previously, the fingerprinting code was using find(1)
without many limitations on the directories it was crawling. For projects using front-end frameworks like Ember or React, crawling node_modules/
would crash my machine after tens or hundreds of seconds. This was unacceptable.
The changes made now do two things: leverage ReaderT
to calculate the fingerprint once (since it's need both to determine if a cache file currently exists, and again to write to the file if it doesn't) and pass that information to both the read and write aspects of the program, as well as read the .gitignore
and factor that into find(1)
by not running against those files/paths. It attempts to norm on file names/paths to ensure all cases are covered.
My experiences personally have been that calculating/reading/writing are roughly 10% to 20% of the previous iteration.
Aliases
This release introduces a basic implementation for aliasing terms. Even though custom configurations aren't supported currently, this change lays the groundwork and provides aliases for a very common case in our Rails applications: RSpec predicate matchers.
RSpec's predicate matchers aren't captured in the ctags file, so by default, unused wouldn't even know to look for them. On top of that, it previously had no way to link matches together. This is important because, apart from special cases, unused determines likelihood of removal based on the number of occurrences a certain token has within a codebase.
A common example that comes up is, within page objects, predicate methods written to be used as matchers. This would allow a developer to write:
# spec/features/create_todo_spec.rb
expect(todos_list).to have_todo(buy_milk)
Based on a page object:
class TodosList
# ...
def has_todo?(todo_on_page)
# ... assert presence on page
end
end
Because TodoList#has_todo?
only existed for RSpec to generate a matcher, it was being bucketed incorrectly as a high likelihood for removal.
This release will likely increase the number of tokens searched for within a codebase, but the performance impacts should be negligible (based on codebase size and number of predicates, of course).