-
Notifications
You must be signed in to change notification settings - Fork 187
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
speed up make_object_linter - ref issue #226 #356
Conversation
formatting remove comment re inability to vectorize `is_declared_here` and `is_external_reference`
Codecov Report
@@ Coverage Diff @@
## master #356 +/- ##
==========================================
+ Coverage 85.7% 85.76% +0.06%
==========================================
Files 41 41
Lines 2154 2164 +10
==========================================
+ Hits 1846 1856 +10
Misses 308 308
Continue to review full report at Codecov.
|
I've updated my code (but have yet to put it on github) - replacing This reduces the run times further
Should I add the new code to the current pull-request?
|
I think as far as the object linter goes we should try to use the approach in #236, IIRC it is pretty close to a drop in replacement, but there are a few corner cases that need to be fixed. |
Cool. Thanks for looking into it; the lintr speed was a bit of a problem for me (mostly in vim/syntastic). |
@jimhester thanks for merging. I will try to have a look at your xpath-based code; I didn't quite follow it the first time round (due to my xpath inexperience). If there's any particular aspect of #236 that you want someone to look at, ping me. Very happy to help on lintr, since one of my packages (and my workflow more generally) depends really heavily on it. I should state that I didn't end up pushing the whole of my work on this PR (the stuff on |
As described in #226 , the speed of the
object_name_...
linters has reduced since introduction of theobject_name_linter("snake_case")
style lintersThe function
make_object_linter
was refactored. Some conditional logic, that checked whether a given object was an operator, a generic or a base-function and bypassed that object if it was, was moved out of an lapply loop into a prefiltering step. This step is vectorised over all object-names in a given file, so speeds up linters that are built usingmake_object_linter
.No additional unit-tests were added
For analysis of the
check.R
file referenced in #318 using a) the CRAN version (1.0.2); b) the current master github version; c) the updated versioncode:
a) cran:
user system elapsed
40.312 0.156 40.820
b) master (ooft!; my laptop isn't great ..):
user system elapsed
577.812 0.984 586.789
c) update:
user system elapsed
324.437 0.078 326.421
326.063 0.109 327.099
I'll admit the improvement is less than two-fold and comes nowhere near the cran version. I get similar speed--up when comparing
lint_package
on thelintr
source code (the only default_linters that were speeded up wereobject_length_*
andobject_name_*
and they had equivalent degree of speedup).Will have a play with other possible changes & try and work out why there's such a big difference between the sys-time speedup (~ 10 fold) and the actual speed up (< 2 fold)