This repository has been archived by the owner. It is now read-only.
Please sign in to comment.
Cache results from FileScanner#scan.
Before this up to 2 calls to Dir.glob could be made every time FileScanner#scan was called. For an average file referring to a set of constants this could introduce significant overhead. This commit changes the workings of FileScanner#scan so that it does two things differently: 1. All possible files are globbed once and then stored. 2. The results of FileScanner#scan are cached per constant path. In terms of numbers, before this commit the script `benchmark/bootup.rb` would report an average exection time of around 1,347707 seconds. This commit reduces that to around 0,903891 seconds, a difference of around 440 miliseconds. Although the decrease might not seem like much, especially for Ruby scripts, it means that it becomes more attractive to use ruby-lint in an editor without having to worry about it locking up the entire editor. For example, when using Syntastic for Vim in the above scenario this would mean that Vim, since it doesn't run plugins in an asynchronous manner, would be locked up for almost half a second *at least*. Benchmarks were performed on a standard Thinkpad T520 with a 5400 RPM HDD running Linux 3.11.6. Numbers may vary for those who use an SSD. See #61 for more information.
- Loading branch information...