Navigation Menu

Skip to content
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

Slow Completion in class with many methods. #412

Closed
StrongerXi opened this issue Dec 12, 2018 · 3 comments
Closed

Slow Completion in class with many methods. #412

StrongerXi opened this issue Dec 12, 2018 · 3 comments

Comments

@StrongerXi
Copy link

Actual behavior (Required!)

Extremely slow auto-complete on an instance of a class with many methods.

Expected behavior (Required!)

Faster completion.

The steps to reproduce actual behavior (Required!)

  • I was having this issue when working on a Swing project; specifically, in a JFrame subclass, when using "this." or "super." .
  • However, when I tried to make a simple JFrame subclass (that only extends, with no additional methods or fields), and profiled it, it's still a little slow but for different reason based on the profile log.

Here are the profile logs:

Very slow, large class:

FUNCTIONS SORTED ON SELF TIME
count  total (s)   self (s)  function
 2265  12.107335   3.954368  <SNR>83_visitTree()
    8   2.358754   2.355879  javacomplete#server#Communicate()
  117   3.774367   2.323149  <SNR>84_blockStatements()
 1336   3.268295   0.532819  <SNR>84_term3()
 5457   0.780340   0.433434  <SNR>84_nextToken()
 1846              0.395145  javacomplete#util#CleanFQN()
   58   0.261263   0.205261  javacomplete#util#Sort()
    4   0.180483   0.180297  <SNR>17_WinDo()
 6349   0.143578   0.125134  <SNR>84_Log()
 9212              0.111228  <SNR>84_scanChar()
  228   1.408234   0.099632  <SNR>84_statement()
 2258   0.192142   0.092508  <SNR>84_scanIdent()
    9   0.265943   0.083504  javacomplete#complete#complete#SearchMember()
   53              0.070358  java_parser#DecodePos()
20129              0.056002  <SNR>19_MemberCompare()
   67   0.080209   0.053540  <SNR>84_gotoMatchEnd()
 1698   0.334568   0.040583  <SNR>84_ident()
 4103   0.131937   0.038121  <SNR>84_Debug()
    1   0.552479   0.032328  <SNR>79_DoGetMemberList()
 1573   0.331214   0.031224  <SNR>84_accept()

A little slow, simple class:

FUNCTIONS SORTED ON SELF TIME
count  total (s)   self (s)  function
    4   1.898488   1.896769  javacomplete#server#Communicate()
 3702              0.789974  javacomplete#util#CleanFQN()
   56   0.248940   0.196473  javacomplete#util#Sort()
    2   1.100976   0.072463  <SNR>78_DoGetMemberList()
    2   0.679864   0.052893  <SNR>78_UniqDeclaration()
19862              0.052467  <SNR>19_MemberCompare()
    4   0.215868   0.050375  <SNR>78_DoGetMethodList()
 4016              0.046632  <SNR>78_CanAccess()
   11   3.030635   0.032729  <SNR>68_InvokeCompletion()
   12   0.476173   0.026353  javacomplete#complete#complete#SearchMember()
   40   0.064094   0.020890  <SNR>83_visitTree()
    2   1.847129   0.011642  javacomplete#collector#FetchInfoFromServer()
   14   3.744932   0.010264  javacomplete#collector#DoGetClassInfo()
   36              0.008732  <SNR>58_Highlight_Matching_Pair()
   69              0.008327  <SNR>68_Pyeval()
   73              0.007480  316()
  719              0.006956  <SNR>78_GenWord()
   74   0.011963   0.006919  <SNR>84_nextToken()
   13   0.007646   0.006409  <SNR>68_IdentifierFinishedOperations()
    4   0.013033   0.005544  <SNR>78_DoGetFieldList()

Environment (Required!)

  • OS: MacOS 10.12.4
  • Vim version: VIM - Vi IMproved 8.1
  • Neovim version:

Q&A

  • Yes, I tried minimal .vimrc configuraion.
  • Yes, I have enabled logs with JCdebugEnableLogs and can put here content of JCdebugGetLogContent command, if you need.
  • Even, if you wish, I can set g:JavaComplete_JavaviLogLevel to 'debug', then set g:JavaComplete_JavaviLogDirectory, and put here server logs, too.
@artur-shaik
Copy link
Owner

Can you, please, make simple project to reproduce. I will try to profile it.

@StrongerXi
Copy link
Author

import javax.swing.JFrame;

class Foo extends JFrame {
  public Foo() {
  }
}

class Bar {
  public Bar() {
  }
}

On my machine and vim at least, the contrast between "this." or "super." in these two classes' methods is huge. I'm wondering if there's anyway to speed it up.

@artur-shaik
Copy link
Owner

Very slow, large class

Should say that this is due too vim parser that used to parse opened java file. It should be faster for large files when we move too javaparser lib.

3702 0.789974 javacomplete#util#CleanFQN()

I guess if you enable this feature: g:JavaComplete_UseFQN, it will work little faster.


And you help me find one performance killer. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants