Closed kubetz closed 7 years ago
Thanks for the pull request, @kubetz, and sorry for the late reply!
Getting the deprecated selectors count should now be negligible, as it delegates to atom.styles.getDeprecations
, which internally consults an in-memory object, so I am going to close this pull request. Thanks again!
My try to help with the performance of
deprecation-cop
.Disclaimer: I am an atom newbie and coffeescript one too for that matter, so I am very open for any feedback, best practices, lessons, etc. :innocent: .
I have noticed that
status-bar
activation times are rather high and found out that a lot of the time is used bydeprecation-cop
package. Helper functions seems to be the main bottleneck of the performance here. @ypresto did already a great job by minimizing calls to the helper functions using_.debounce
.What is still taking a solid amount of time is the initial
@update
of theDeprecationCopStatusBarView
when the view is attached as it is not usingdebouncedUpdateDeprecatedSelectorCount
function available in the view.Here is a screenshot showing a performance impact of an immediate
@update()
(usingperformance.now()
for measuring the time):Here is a screenshot after using
debouncedUpdateDeprecatedSelectorCount()
instead ofupdate()
:The downside of not using immediate
@update()
is that the initial information is communicated to the user later, of course. I had to hide the view during initialization because of this reason to prevent showing the initial0 deprecations
for 1s until the@update
was called and the view was hidden.I added some comments to the source code.