-
Notifications
You must be signed in to change notification settings - Fork 20
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
Run command in another process to avoid freezing neovim #245
Conversation
end | ||
if result.stdout ~= nil and result.stderr ~= "" then | ||
err = err .. " " .. result.stderr | ||
if output ~= nil and error ~= "" then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be
if error ~= nil and error ~= "" then
I kept the old logic, but I'm not sure why it was that way
Hey @BrunoMazzo and thanks for this! I understand Neovim froze up on you completely but with this change it is still responsive while waiting for the command to finish? After having a quick look, I think we can potentially make other optimizations too:
Good call on making use of I'm busy during the holidays and somewhat AFK until Jan 8th, but will have a look at this when I get the chance. |
By the way, let me know if this big monorepo is open source. It's always good to have something real to profile against. |
This comment was marked as outdated.
This comment was marked as outdated.
Thanks! The branch really helps with the freezing. Just one thing I noticed. Running the whole file is way slower than just running the top test that wraps all the tests. The difference between the two Unfortunately, the project is a private one. |
I actually updated the cwd in this PR already: #246 So maybe you are just not yet on that change on your end? |
@BrunoMazzo I just released v1.7.2. Can you please confirm that you are still seeing freezing in Neovim due to long-running |
I will test it right now. But just to confirm, the line I was talking about was line
|
I can confirm here that the performance is way better! There is still a small slow down, but nowhere near the long freeze it was. Amazing work!! Thanks a lot! |
Ah, that cwd is used only for the --- @type neotest.RunSpec
local run_spec = {
command = test_cmd,
- cwd = go_mod_folderpath,
+ cwd = pos_path_folderpath,
context = context,
}
Nice to hear! 🎉 In regards to the async calling of |
@BrunoMazzo would you mind testing the |
I tested here, there is a small improvement, but not much to be honest. I think the other commits fixed most of the problems. The only noticeable improvement is when I ran all the tests, but not a massive one. There is a still freezing, but way less than before. I usually only run the current file so it is good enough for me. In File tests there is basically a small lag now sometimes, but no freezing, before it was always freezing.
I don't know why, but there is a massive difference in performance on the project. Selecting the top test and running as the nearest test takes around 4 seconds from the keypress to the icon change to green tick, but running the file as test takes more than one minute. I did changed it locally and it fixes it. But I agree that it shouldn't matter, but my tests are saying that it matters. I will try to dig here a little more to see if I can find any other reason for it. |
Yes, I'm using it. |
That's great to hear, that the already merged changes made a difference. What I improved was to limit the work done by I actually don't think I will try to make the
I wonder if this freezing is due to the
Aha, so you actually experience a significant improvement when you change the cwd path in You can inspect the logs and extract the But since this cwd change seem like it matters in big projects, we can definitively change this path permanently - as it technically is fine to it this way too. |
Please let me know what differences you can see with v1.7.3, which I just released. |
Amazing! Now running the file has the same performance than running just the top file! Thank you very much for the work! |
Firstly, thanks for the plugin!
I'm working in a massive monorepo and Neovim freezes for around 2 seconds when I try to run one test file. I did a little of digging and found out that
go list
was producing around 270k lines of output and taking around 2 seconds to run. I was able to test here and verify that it was the reason for most of my freezing time.Changing from
vim.system
toasync.process.run
fixes most of the problem. But I just had to changevim.fn.json_decode
tovim.json.decode
because the string now was not utf8 anymore.I still have a small freeze, even with this solution, my investigation is saying that the processing of this long string is the cause, but I didn't find a good solution for it yet. But now the experience is way better.