asyncrun.vim icon indicating copy to clipboard operation
asyncrun.vim copied to clipboard

[Windows] AsyncRun is order of magnitude slower than :make

Open hia3 opened this issue 7 years ago • 3 comments

This takes 1 second to complete and populate Quickfix:

:set makeprg=type\ 2MB_text_file
:make

(Here 2MB_text_file is a text file of size 2MB)

Running the same command with :AsyncRun will take 30 seconds:

:AsyncRun type 2MB_text_file

Can this be improved?

Thanks.

hia3 avatar May 16 '18 06:05 hia3

It's not a performance issue, instead, it is a flow control strategy. Populating quickfix items one by one is slower than populating all the items at once. If the strategy doesn't exist, vim's ui will get stuct while background process emits a lot of output in a short time.

So, in order to prevent typing lag and ensure fluent , editors (like EditPlus, NotePad++) will limit the number of messages added to their message panel in one seconds.

You may try to tune the g:asyncrun_timer option, increase it will improve the speed, but beware that vim's gui may freeze if you are trying to insert a lot of messages in quickfix window in a short time.

skywind3000 avatar May 16 '18 07:05 skywind3000

Thank you for the quick reply.

I tried following settings:

let g:asyncrun_timer = 100     - 84sec
let g:asyncrun_timer = 150     - 59sec
let g:asyncrun_timer = 200     - 50sec
let g:asyncrun_timer = 250     - 43sec
let g:asyncrun_timer = 2500    - 42sec
let g:asyncrun_timer = 25000   - 42sec

Looks like it can't go faster than 50KB/s.

I don't have Notepad++, but VS Code works fine in this scenario (even 120MB is not a problem, it just becomes slightly less responsive).

(if you want to try this with VS Code, add following to tasks.json)

    {
        "label": "type 120MB",
        "type": "shell",
        "command": "type 120MB_text_file"
    }

hia3 avatar May 16 '18 08:05 hia3

The recent vim (after 8.0.200 ?) has a similar strategy, asyncrun.vim can do nothing about this.

skywind3000 avatar May 16 '18 08:05 skywind3000