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

Intellisense slow on 5k files #274

Closed
TheColorRed opened this issue Feb 3, 2017 · 37 comments · Fixed by #680
Closed

Intellisense slow on 5k files #274

TheColorRed opened this issue Feb 3, 2017 · 37 comments · Fixed by #680
Labels

Comments

@TheColorRed
Copy link

I like the new auto completion tool and, I have a Laravel project that parses the files like so:

All 5568 PHP files parsed in 253 seconds. 178 MiB allocated.

When I type $someVar-> it takes about 2 seconds until the suggestions show up.

@felixfbecker
Copy link
Owner

felixfbecker commented Feb 3, 2017

Hmm, aggregating the completion results should be O(n).
This would be interesting to profile.

@TheColorRed
Copy link
Author

Not sure if you saw this in the release notes of VSCode 1.9, but there is a php parser they are working on

https://github.com/Microsoft/tolerant-php-parser

Might be helpful in some way...

@felixfbecker
Copy link
Owner

Yes, I am aware of it 🙂

@autoferrit
Copy link

I have a similar issue on a Code igniter project. The autocompletion for class methods doesnt even pop up until I hit ctrl + space, then takes a few seconds. If i delete the -> and do it again, same thing. it doesnt cache the results either. but that is probably a different issue?

@jens1o
Copy link
Contributor

jens1o commented Jun 10, 2017

@autoferrit afaik the results are not cached, but only the files where we get the results right. I think that's the bottleneck, yes.

@binarious
Copy link

binarious commented Oct 27, 2017

CTRL + Space takes about 12 seconds for me. I do have 10k PHP files:

All 10140 PHP files parsed in 16 seconds. 504 MiB allocated.

macOS: 10.13
3,7 GHz Quad-Core
12 GB RAM
PHP: 7.1.10
Extension: 1.5.2
Code: 1.17.2

@bmax
Copy link
Contributor

bmax commented Nov 11, 2017

Hi! @felixfbecker willing to work on this -- Do you have any suggestions on the best place to start? Profiling it with XDebug?

@lndj
Copy link

lndj commented Jan 27, 2018

Has anything help now?

@binarious
Copy link

I had to switch to PHP Intelephense.

@lndj
Copy link

lndj commented Jan 30, 2018

@binarious is it faster?

@binarious
Copy link

@lndj It just works for me. Suggestions and method signatures show up instantly on very large projects.

@madbbb
Copy link

madbbb commented Mar 16, 2018

@TheColorRed
Have you disabled VSCode built-in suggestions? Try to set "php.suggest.basic" to false in settings.

@koloda
Copy link

koloda commented Mar 31, 2018

Same trouble, about 15 seconds, Yii2 basic project. And i switch to PHP Intelephense.

@Vercoutere
Copy link

I've also switched to Intelephense for now. Unfortunately Intelephense has it's own set of issues, but I can't live with autocomplete times of over 5 seconds in my project.

I noticed @bmax didn't get any response to his offer to work on this in over 4 months. Can we expect this to be resolved at some point in the near future, or are we out of luck for the time being?

@bmax
Copy link
Contributor

bmax commented Apr 3, 2018

@Vercoutere I ended up not putting any time into working on this because there happened to be a couple of other PR's started. I'm not sure why they haven't been merged. I have heard good things about Intelephense though.

@Ciantic
Copy link

Ciantic commented Apr 19, 2018

Is the slowness coming from this:

CompletionProvider.php Lines 246-251

            foreach ($this->index->getDefinitions() as $fqn => $def) {
                foreach ($prefixes as $prefix) {
                    if (substr($fqn, 0, strlen($prefix)) === $prefix && $def->isMember) {
                        $list->items[] = CompletionItem::fromDefinition($def);
                    }
                }
            }

There is no trie index or anything like that, but everything is always looped through and it filters the matching ones in the loop?

@autoferrit
Copy link

Has there been any updates on fixing this?

@jens1o
Copy link
Contributor

jens1o commented Jul 27, 2018

@felixfbecker Is it really neccessary to check each definition whether it starts with the prefix? Visual Studio Code is able to filter out, too?

@nmsmith22389
Copy link

Same issue here... Takes up to 15 seconds on ctrl + space. Looking for a solution.

@ifeltsweet
Copy link

A little discouraging that a few attempts have been made by community to fix this but not enough attention has been given to review it. The main purpose of this project is to assist developers in writing code faster. Unfortunately it fails at it right now due to these long standing performance problems. @felixfbecker, thank you for all your efforts! It's greatly appreciated, and I'm sorry to complain, but I felt like it's important to say this.

@felixfbecker
Copy link
Owner

Is anyone interested in bringing #599 over the finish line?

@jens1o
Copy link
Contributor

jens1o commented Sep 21, 2018

I could do that, but only in two weeks(having a trip from tomorrow until next week). Hope someone else can do that earlier. :)

@cmatzenbach
Copy link

We of the emacs-php community are eagerly awaiting this merge :) Thanks to everyone who put time into this PR! It's going to be big for the community

@cyrialize
Copy link

Another member of the emacs-php community - just wanted to echo what @cmatzenbach said above! Thank you so much for all of your work! This is gonna make programming in PHP a much better experience in emacs.

@feedmeastraycat
Copy link

@felixfbecker I saw that the PR seems to be basically done. Is it possible somehow to test @jens1o's branch of php-language-server locally in vscode-php-intellisens?

@felixfbecker
Copy link
Owner

Yes, all you need to do is symlink your local language server repo clone into ~/.vscode/extensions/felixfbecker.php-intellisense-x.x.x/vendor/felixfbecker/language-server

@jens1o
Copy link
Contributor

jens1o commented Nov 6, 2018

Thanks for the ping. Forgot to push. This is the current thing I've on. However, some tests are still failing currently. jens1o@f45c44f

@felixfbecker
Copy link
Owner

Feel free to open a work-in-progress PR

@MichaelBelgium
Copy link
Contributor

[Info - 9:39:44 PM] All 5316 PHP files parsed in 8 seconds. 394 MiB allocated.

It's getting parsed for me in less seconds but yeah doesn't change the fact it's slow in auto completing. Can't wait for a fix!

@felixfbecker
Copy link
Owner

@MichaelBelgium if you can't wait, help out :)

@MichaelBelgium
Copy link
Contributor

@MichaelBelgium if you can't wait, help out :)

Is this what needs to be done?

@felixfbecker
Copy link
Owner

Yes

@jens1o
Copy link
Contributor

jens1o commented Nov 7, 2018

Okay, thanks for taking your time. :)

@MichaelBelgium
Copy link
Contributor

MichaelBelgium commented Nov 7, 2018

Okay, thanks for taking your time. :)

Anytime :) if it's only a simple merge ... surprised nobody did it before me.

felixfbecker pushed a commit that referenced this issue Nov 11, 2018
Refactors Index into a tree structure, rather than an array of Fqns to definitions.

Closes #274
@felixfbecker
Copy link
Owner

🎉 This issue has been resolved in version 5.4.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@felixfbecker
Copy link
Owner

felixfbecker commented Nov 11, 2018

This is released for VS Code in https://github.com/felixfbecker/vscode-php-intellisense/releases/tag/v2.3.6 🎉

I think this also included these other PRs: https://github.com/felixfbecker/php-language-server/pulls?q=is%3Apr+is%3Aopen+author%3ADeclspeck+sort%3Aupdated-desc

@midN
Copy link

midN commented Jun 7, 2019

I had to switch to PHP Intelephense.

Same, the issue is still happening, had to switch, now it's instant..

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

Successfully merging a pull request may close this issue.