Peekmo / atom-autocomplete-php

Autocomplete for PHP in atom editor
MIT License
136 stars 34 forks source link

[Linux] High CPU usage on indexing/parsing #301

Open ghost opened 8 years ago

ghost commented 8 years ago

.atom/packages/atom-autocomplete-php/php/providers/../parser.php keeps spawning indefinetely, in result atom is indexing without end and my cpu goes above 75% usage, that ain't normal. And it keeps reindexing same files that doesn't change. What is the point of reindexation of files that haven't been changed?

apm 1.14.1 npm 3.10.5 node 4.4.5 python 2.7.12 git 2.7.4

atom-autocomplete-php@0.20.2 atom-beautify@0.29.13 atom-symfony2@0.2.1 autoclose-html@0.23.0 autocomplete-php@0.3.7 autoprefixer@3.3.0 docblockr@0.8.7 emmet@2.4.3 goto-definition@1.1.19 highlight-selected@0.11.2 language-smarty@1.7.0 linter@1.11.20 linter-csslint@1.3.3 linter-htmlhint@1.3.1 linter-jshint@3.0.1 linter-jsonlint@1.3.0 linter-php@1.3.1 linter-sass-lint@1.7.4 logo-file-icons@1.3.0 opened-files@0.3.6 perfectionist@1.2.0 php-cs-fixer@2.5.9 php-integrator-autocomplete-plus@1.1.5 php-twig@4.0.0 pigments@0.38.0 symfony-snippets@0.3.0 tabs-to-spaces@1.0.2 tree-ignore@0.6.2

XUbuntu 16.04 LTS 64bit Intel i5-3220M @ 3.2 GHz Samsung 850 EVO SSD 16 GB RAM

Peekmo commented 8 years ago

Hi,

All the project is reindexed every time you open the project. And only the current file is reindexed when you save it.

It should end, does it happens on a specific framework / lib ?

ghost commented 8 years ago

Symfony2 projects, haven't tried on others.

I checked it out a bit and may have found where it goes wrong for me. Opening new project or restarting current one (for example, after package update), spawns more parsers but the ones that were running before, doesn't stop. killing atom should end parsers but it doesn't do it.

maybe you could add something to limit number of parsers running parallel? I need to have two projects open at the same time, so currently I have 6 simultaneous parsers and all 4 cpus is above 80% usage. or maybe you could limit some usage? because even for one parser, high cpu usage is kind of unpleasant

joseluisq commented 7 years ago

I have Fedora 25 and the same issue occurs in my Laravel 5.4 project. The indexing task takes a lot amount of CPU. I hope you can fix this soon.

joseluisq commented 7 years ago

Is there any progress on this issue? Here some screenshots about...

Indexing start: when my Laravel 5.4 project is opened for the first time. screenshot from 2017-06-12 12-50-56-copy2

Indexing end: screenshot from 2017-06-12 12-56-22_copy2_end

My specs: Fedora 25 64bit Intel i5-4210U CPU @ 1.70GHz 4 GB RAM

Peekmo commented 7 years ago

Hello,

No, the full index is looking for all classes and index them in a file as a JSON. But the more you have classes, the more that JSON will grow (and consume memory). The only way to solve it, is to find a new way to store that index.

joseluisq commented 7 years ago

I think that you could try to store these indexes in some fast key-value storage (json-like) for example using LevelDB. Here the nodejs wrapper LevelUP.