chrisbra/Recover.vim

request to avoid 'sleep'

Closed this issue · 3 comments

On Windows, this line:

call system(cmd)

Takes 3 seconds. (though if I execute that command in cmd.exe it's less than 1 second)

I'm not sure how to make it faster, but it would reduce the pain if one didn't also need to wait another 2 seconds here:

https://github.com/chrisbra/Recover.vim/blob/master/autoload/recover.vim#L225

Would you consider removing that sleep 2 call? The message "Found SwapFile, opening file readonly!" is written to the :mes log already, and the user made the choice so presumably doesn't need a 2-second notification of that choice immediately after.

Hi Justin!

On Di, 19 Aug 2014, Justin M. Keyes wrote:

On Windows, this line:

call system(cmd)

Takes 3 seconds. (though if I execute that command in cmd.exe it's less than 1 second)

I'm not sure how to make it faster, but it would reduce the pain if one didn't also need to wait another 2 seconds here:

https://github.com/chrisbra/Recover.vim/blob/master/autoload/recover.vim#L225

Would you consider removing that sleep 2 call? The message "Found SwapFile, opening file readonly!" is written to the :mes log already, and the user made the choice so presumably doesn't need a 2-second notification of that choice immediately after.

Let's try this and see if someone complains ;)

Best,

Christian

Ich war der beste, den ich jemals hatte.
-- Woody Allen (eigentlich: Woody Stewart)

Thanks!

On Windows, this line:

call system(cmd)

Takes 3 seconds. (though if I execute that command in cmd.exe it's less than 1 second)

That was with set noshelltemp. After set shelltemp, the command takes only 1.2 seconds:

    1   0.000419   0.000400     let cmd = printf("vim -u NONE -N %s -r %s -c \":w %s|:q!\" %s diff %s %s", (s:isWin() ? '' : '-es'), (s:isWin() ? fnamemodify(v:swapname, ':p:8') : shellescape(v:swapname)), tfile, (s:isWin() ? '&' : '&&'), bufname, tfile)
    1   1.220848   0.002491     call system(cmd)

Guess I will go back to set shelltemp on Windows...