artur-shaik / vim-javacomplete2

DEPRECATED in favor of jc.nvim
Vim License
973 stars 83 forks source link

Take loog time when first time open java file #309

Closed wsdjeg closed 7 years ago

wsdjeg commented 7 years ago

I am not sure why it take too long time when first time I open a java file, you can hava a look at

https://asciinema.org/a/3qf5mv191b6o0oz74nxu45sdj

wsdjeg commented 7 years ago

here about 1s, when I type enter in ctrlp buffer, but sometime it need more than 10s.

artur-shaik commented 7 years ago

With clean vimrc the same?

wsdjeg commented 7 years ago

yes, run vimtest in the root of this plugin, vimtest means

alias vim='nvim'
alias vimtest='vim -u NORC --cmd "exe '\''set rtp+='\'' . getcwd()"'

then run

:e libs/javavi/src/main/java/kg/ash/javavi/Javavi.java

it need about 5s.

artur-shaik commented 7 years ago

I know some start up delay issues exists, such:

That's why we still have limitations section in readme.

So, this is hard to say what exactly influence on your issue. It would be great if you can find those narrow places. I think 10 seconds is too much.

wsdjeg commented 7 years ago

I will look into it later.

wsdjeg commented 7 years ago

here is result of

:profile start /tmp/profile.log
:profile file *
:profile func *
:e foo.java
:q
FUNCTIONS SORTED ON TOTAL TIME
count  total (s)   self (s)  function
    4  12.138845   0.009337  dein#autoload#_on_default_event()
    4  12.127783  12.090211  <SNR>24_source_events()
    8  12.121440   0.174086  dein#autoload#_source()
    3  11.623681   0.007663  javacomplete#Start()
    3  11.614732   0.018685  javacomplete#server#Start()
    1  11.031543  10.982287  <SNR>242_GetServerAppVersion()
   11   0.489365   0.347676  provider#python#Call()
    1   0.389266   0.002054  javacomplete#server#GetClassPath()
    1   0.377331   0.377274  <SNR>242_System()
    1   0.339155   0.338405  javacomplete#server#Terminate()
    4   0.144940             <SNR>242_Poll()
    1   0.141689   0.000069  remote#host#Require()
    1   0.141620   0.141605  provider#pythonx#Require()
    3   0.100574   0.053569  <SNR>93_SynSet()
    1   0.063047   0.001355  dein#autoload#_on_cmd()
    1   0.060224   0.000037  javacomplete#classpath#classpath#BuildClassPath()
    1   0.060186   0.000241  <SNR>239_BuildClassPath()
    2   0.058146   0.009378  <SNR>242_GetJavaviClassPath()
    8   0.056278   0.054216  javacomplete#util#GlobPathList()
    1   0.054643   0.000241  <SNR>239_FindClassPath()

FUNCTIONS SORTED ON SELF TIME
count  total (s)   self (s)  function
    4  12.127783  12.090211  <SNR>24_source_events()
    1  11.031543  10.982287  <SNR>242_GetServerAppVersion()
    1   0.377331   0.377274  <SNR>242_System()
   11   0.489365   0.347676  provider#python#Call()
    1   0.339155   0.338405  javacomplete#server#Terminate()
    8  12.121440   0.174086  dein#autoload#_source()
    4              0.144940  <SNR>242_Poll()
    1   0.141620   0.141605  provider#pythonx#Require()
    8   0.056278   0.054216  javacomplete#util#GlobPathList()
    3   0.100574   0.053569  <SNR>93_SynSet()
    6   0.054447   0.051715  <SNR>24_source_plugin()
    3   0.036860   0.034120  <SNR>90_LoadFTPlugin()
    1   0.030561   0.027029  <SNR>242_CheckServerAccordance()
    2              0.026535  <SNR>24_is_reset_ftplugin()
    1   0.025673   0.024015  <SNR>239_UseGradle()
    1              0.023937  javacomplete#classpath#maven#IfMaven()
    3              0.022408  dein#util#_globlist()
  577              0.021961  <SNR>208_is_file_exist()
    3  11.614732   0.018685  javacomplete#server#Start()
    2              0.018544  airline#util#system()
artur-shaik commented 7 years ago

Did I understand right that 242_GetServerAppVersion take almost 11 seconds?

wsdjeg commented 7 years ago

yes, I think so,

artur-shaik commented 7 years ago

Hm, that strange. Made the same, here my results:

FUNCTIONS SORTED ON TOTAL TIME
count  total (s)   self (s)  function
    1   1.388845   0.000039  startify#open_buffers()
    1   1.388806   0.017251  <SNR>147_open_buffer()
    1   1.114214   0.000462  javacomplete#Start()
    1   1.113313   0.007323  javacomplete#server#Start()
    1   1.101361   0.000162  <SNR>172_GetServerAppVersion()
    1   0.333567   0.325246  javacomplete#server#Terminate()
    3   0.153758             UltiSnips#SnippetsInCurrentScope()
    2   0.120062   0.004337  <SNR>153_OnBufferRead()
    1   0.075995   0.000208  neomru#_save()
    2   0.075787   0.001723  108()
    1   0.056748   0.002061  <SNR>153_OnBufferEnter()
    1   0.041667   0.003018  113()
 1002   0.038846             <SNR>174_is_file_exist()
    2   0.028710   0.000158  <SNR>174_uniq()
    2   0.028552             <SNR>174_uniq_by()
    2   0.017977   0.000979  <SNR>8_LoadIndent()
    6   0.017588   0.017497  <SNR>153_OnFileReadyToParse()
    2   0.013072   0.005080  <SNR>7_LoadFTPlugin()
    1   0.011744   0.000060  <SNR>11_lod_ft()
    2   0.008710   0.000178  <SNR>65_setup()
artur-shaik commented 7 years ago

What if you run:

java -cp javavi/target/classes:javavi_log4j-api.jar:javavi_log4j-core.jar:javaparser.jar kg.ash.javavi.Javavi -version

From vim-javacomplete2/libs directory?

wsdjeg commented 7 years ago

it take me 3s, I think maybe it is due to my pc is too old.

artur-shaik commented 7 years ago

What cpu you have? And what java version?

wsdjeg commented 7 years ago

I use time java -cp javavi/target/classes:javavi_log4j-api.jar:javavi_log4j-core.jar:javaparser.jar kg.ash.javavi.Javavi -version

real       0m1.940s
user       0m2.527s
sys    0m1.107s
wsdjeg commented 7 years ago

I use open jdk 8, and my cpu is i5, but my pc is 6 years old, sorry for this issue.

artur-shaik commented 7 years ago

I use i5, too. I think it's due some java slow start issues. And by the way, my java is oracle hotspot.

wsdjeg commented 7 years ago

yeah, I will try to install oracle jdk. thanks!