wooorm / linter-remark

Check markdown with remark in atom
MIT License
12 stars 1 forks source link

schedule lazy dependencies #12

Closed BarryThePenguin closed 6 years ago

BarryThePenguin commented 6 years ago

This isn't complete, but it's part way towards quicker load times when using linter-remark

I based this off the linter-eslint package

The current changes reduced load time from >250ms to <5ms

There's most likely timing issues around the engine not being ready before lint is called

BarryThePenguin commented 6 years ago

Thanks for the feedback ☺️

It now cancels the callbacks on deactivate and loadDeps is called just before the engine is built

wooorm commented 6 years ago

Looks good!

wooorm commented 6 years ago

Done, albeit a little bit refactored! I saw a note about not being ready yet, is that still the case, or is it good to go now?

BarryThePenguin commented 6 years ago

Everything should be good now. @Arcanemagus covered everything I was originally missing

Arcanemagus commented 6 years ago

FYI, this is an example of what this looks like in the CPU profiler: image

That's why the "work" functions are given a name and not just fed in, since otherwise there is no way to know where they are coming from when profiling. This method has that callback function at the top of the stack instead of the named one directly on the top, but the benefit of abstracting that setup out outweighs that minor bit to me at least.

wooorm commented 6 years ago

Published! Thanks both!