Community
Participate
Working Groups
Hi, I work with many big PHP files (5k-20k lines) but only with one I have a huge slowdown when I try to edit it. I noted that in that file we defined a class with 136 constants defined. I made a simple test script to reproduce the slowdown: <?php $sTest = "<?php class CTest{\n"; for($i = 1; $i < 2000; ++$i){ $sTest .= "const ICONST$i = $i;\n"; } $sTest .= "function test(){}\n"; $sTest .= "} ?>"; file_put_contents('CTest.php', $sTest); ?> This test script will generate a PHP file with 2000 constants. Add the file CTest.php to your PHP project in Eclipse. (Maybe build the project.) If you try to type something in the test method, you will experience a huge slowdown. Let me know if I can help further. Best regards, Laurent Lyaudet
Hi, did you test it on 3.3.1 development snapshot [1]? This build have some improvements for large files/projects. I cannot reproduce your problem. [1] - http://download.eclipse.org/tools/pdt/updates/3.3-nightly/
I was able to reproduce it with latest version. To trigger the slowdown Outline view must be visible. I also clicked few times in Outline elements. Typing and scrolling is almost impossible.
Problem is probably caused by code from PHPContentOutlineConfiguration.getSelection(): ... Widget testFindItem = viewer .testFindItem(lastSelection); if (testFindItem == null) { viewer.refresh(); } ... Removing this part makes file usable. After opening file there is a glitch for a moment, but after that file can be used normally. This code was introduced in https://bugs.eclipse.org/bugs/show_bug.cgi?id=321228
(In reply to Michal Niewrzal from comment #3) > Removing this part makes file usable. After opening file there is a glitch > for a moment, but after that file can be used normally. This code was > introduced in > https://bugs.eclipse.org/bugs/show_bug.cgi?id=321228 This code was required to keep selection in outline while writing. Maybe now will be possible to remove these lines. Michal, did you reproduce it on windows or on another system?
I'm not sure if this code should be removed. I just pointed place responsible for problem:) Tomorrow I will look at it more carefully. I reproduce it under Linux x64.
This patch should remove following issues (root of the problem): * Every change in editor that was changing model was starting refresh for every previously opened editor with Outline view * Every change in editor that was changing model was refreshing whole Outline view There are still some performance issues when file with many (~2000) functions/classes is saved, but I will create separate bug for this problem. Patch proposal: https://git.eclipse.org/r/#/c/32793/
Merged: https://git.eclipse.org/c/pdt/org.eclipse.pdt.git/commit/?id=16d9601aa9de6e869864c857360f1af7a2bff662 Thank you
Thanks for the patch Michal. It corrects the slowdown when I type something. However, there is still a slowdown when I save the file CTest.php after edit (if I save another file that is opened in another tab I have no slowdown). This slowdown is made of the following sequence : file save action(Ctrl+S), freeze for 2-3 seconds (you can still move the cursor but you cannot click something) then the blue circle "something in progress" appears for 7-6 seconds, freeze for 1-2 seconds then the blue circle appears for 6-5 seconds, freeze for 2-3 seconds then the blue circle appears for 8-7 seconds. I assume these 3 consecutive freezes corresponds to 3 distinct process triggered by the file save action. There must be some process with complexity \omega(n^2) or worse (where n is the number of constants in the file) that is triggered. Maybe it can be improved to obtain O(n) or O(nlog n) complexity. If you can find this process(es), I may help. Best regards, Laurent Lyaudet
Thanks for checking my patch Laurent. Problem with saving should be resolved when patch from https://bugs.eclipse.org/bugs/show_bug.cgi?id=443468 will be merged:) I dived this problem into smaller packages.
So if the slowdown is fixed, and there is another bug about the save freeze can we close this one?
Closed.