duaraghav8 / Ethlint

(Formerly Solium) Code quality & Security Linter for Solidity
https://ethlint.readthedocs.io/en/latest/
MIT License
927 stars 128 forks source link

Make blocking function async #105

Open travs opened 7 years ago

travs commented 7 years ago

I'm finding that parsing large solidity files (500+ lines) takes a few seconds, which is fine in and of itself. The problem is that it seems to be a blocking function, which is a little bit of a dealbreaker for the solium linter I have written for Atom, since it blocks the UI and makes the editor pane unusable for a few seconds.

I ran a profile, and it looks like the blocking is coming from within the parse function in solparse here. It might specifically be the peg.js calls that are blocking, since it looks like that library might not support async, so I'm not sure if simply making the solparse parse function async would fix it.

I attached the profile file for the atom linter package, which you can open in chrome I believe.

solium-linter.zip

duaraghav8 commented 7 years ago

@travs (My knowledge on Atom plugin dev is 0 but) Shouldn't Atom be providing a way to run your plugin in a separate thread? I'm saying this because I think something like that should be possible because not every plugin is suitable for the main thread (use case- some plugin could simply be doing background clean-ups, so it need not be on main thread at all).

On the other hand, I did realise that we'd eventually have to work with parsing asynchronously, but I haven't even started planning that yet so it might take some time (~2 months).

travs commented 7 years ago

@duaraghav8

Shouldn't Atom be providing a way to run your plugin in a separate thread?

This is certainly a possible solution to my package's problem. I will try to run solium.lint() in a child process and see what happens.

I haven't even started planning that yet so it might take some time (~2 months)

No problem at all. Once you get it laid out tag me in the issue(s) and I can have a look to see if I can contribute :)