Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326261

Summary: 1.3.1.20100916-1202 makes editor unusable with large PHP files - kills performance
Product: z_Archived Reporter: Maciej Lisiewski <c2h5oh>
Component: PDTAssignee: Zhongwei Zhao <zhaozhongwei>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P2 CC: bangou86, dan, daniphp, dev, dziastinux, edam, eric.pub, ganoro, henry, ihabunek, j.visser, kristian, kristianwiborg, l.piccini, mark.stichweh, mauromol, nicolas.bros, otto.giesenfeld, qiangsheng.w, sempasha, silviya, song7749, sorongo, stu, TrinitronX, yhjhoo, zhaozhongwei, zulus
Version: unspecifiedFlags: zhaozhongwei: review? (ganoro)
qiangsheng.w: review+
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Attachments:
Description Flags
patch
none
new patch
none
patch
none
patch
none
patch for dltk none

Description Maciej Lisiewski CLA 2010-09-26 15:34:05 EDT
Build Identifier: 20100917-0705

When editing a large (5-10k lines) php file every single change, such as typing a single character (or pasting a block of text - doesn't matter) causes editor to freeze for about 6-8 seconds.
There is no problem with small files (tested with ~100 lines).
It doesn't matter where I start typing - beginning or end, inside a string, html block or in the middle of variable name.
During the freeze CPU usage spikes to 100%. 

I have tried disabling the most CPU hungry features, such as disabling most validators and 'report problems as I type' - made no difference, neither did quadrupling the memory available to Eclipse by editing eclipse.ini.

This problem did not exist with 20100617-1415 I have been using until recently - it started after I have updated via automated update to 1.3.1.20100916-1202. 
I have downloaded 20100617-1415 again and the very same files that fail with the newer one work like a charm, even with all validators enabled and default memory settings.

There have been a similar looking problem 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=323401
but that one is related to folding feature, which doesn't make any difference here.

Reproducible: Always

Steps to Reproduce:
1. Open a large PHP file (large = 5k+ lines)
2. Try to edit it
Comment 1 Maciej Lisiewski CLA 2010-09-26 15:45:03 EDT
Just one note: by every single change I mean that if I were to type 'performance' I should expect at least a minute of waiting with a single letter appearing every 6-8 seconds.
If I pasted 'performance' in I would only wait once - after 6-8 seconds whole string would appear.
Comment 2 Roy Ganor CLA 2010-09-26 18:13:57 EDT
let's check this out...
Comment 3 Semenov Pavel CLA 2010-09-28 04:19:11 EDT
I have same problems after my Eclipse had updated.
In my case (Intel E2180@2Ghz CPU, 2Gb memory, Windows XP) files just more then 500 lines makes editor slowly, 1000 lines and more makes it slow, and 3000 lines causes system freezes about 10 seconds per single char typing.

Folding options are disabled.

Please check this problem.
Comment 4 Roy Ganor CLA 2010-09-28 04:55:51 EDT
*** Bug 326382 has been marked as a duplicate of this bug. ***
Comment 5 dziastinux CLA 2010-09-28 07:24:26 EDT
I have the same problem too (win7, eclipse 3.6). 

For me 3k+ lines is enough that typing single char would freeze eclipse for 2-3s. 
I've tried to dedicate more memory (-Xms512M -Xmx1024M -XX:MaxPermSize=350m) but nothing changed.
Disabling any options make no difference.

Just for the record: Eclipse handle 12k+ JavaScript files with no problems.
Comment 6 Piccio CLA 2010-09-30 11:54:35 EDT
has anyone found a solution?
Comment 7 Maciej Lisiewski CLA 2010-09-30 12:14:30 EDT
(In reply to comment #6)
> has anyone found a solution?
AFAIK no, for now download PDT again from http://www.eclipse.org/pdt/downloads/
2.2.0 packages do not include the latest update yet - they don't have this issue - just ignore autoupdate while waiting for the fix.
Comment 8 Kristian Wiborg CLA 2010-10-22 03:33:22 EDT
(In reply to comment #7)
> (In reply to comment #6)
> > has anyone found a solution?
> AFAIK no, for now download PDT again from http://www.eclipse.org/pdt/downloads/
> 2.2.0 packages do not include the latest update yet - they don't have this
> issue - just ignore autoupdate while waiting for the fix.

Yes, it seems the only solution is not to upgrade. I'm experiencing the same issue along with ppl in the forums: http://www.eclipse.org/forums/index.php?t=msg&goto=634542
Comment 9 Zhongwei Zhao CLA 2010-10-22 04:17:10 EDT
hi guys

This has been fixed in latest code,the reason may be as  Maciej Lisiewski said,but I am not sure.
Comment 10 edam CLA 2010-10-28 08:19:43 EDT
(In reply to comment #9)
> This has been fixed in latest code

This is great news!

This bug makes using Eclipse as PHP editor almost impossible! Even a file with 2k lines causes a 1-2 second freeze between *each* keypress! (Although not arrow keys). Is there an immediate fix we get hold of? An update site for the latest development PDT build perhaps? Or a pre-compiled package we can download?
Comment 11 edam CLA 2010-10-28 09:01:00 EDT
Sorry, I've just re-read your message...

(In reply to comment #9)
> the reason may be as  Maciej Lisiewski said,but I am not sure.

Can you clarify what you mean - I don't think Maciej Lisiewski suggested a cause? What was the fix?
Comment 12 Maciej Lisiewski CLA 2010-10-28 17:44:56 EDT
(In reply to comment #11)
> Sorry, I've just re-read your message...
> 
> (In reply to comment #9)
> > the reason may be as  Maciej Lisiewski said,but I am not sure.
> 
> Can you clarify what you mean - I don't think Maciej Lisiewski suggested a
> cause? What was the fix?

I didn't - I just pointed out that you can download previous version to have a working PDT copy till the bug is fixed.
Comment 13 edam CLA 2010-11-10 15:17:33 EST
(In reply to comment #12)
> I didn't - I just pointed out that you can download previous version to have a
> working PDT copy till the bug is fixed.

Ahh, sorry, I get it. I don't suppose that you know of a link to the previous version, do you? I'm not yet familiar with finding packages on Eclipse's website. I *have* tried, too.  :o)
Comment 14 Zhongwei Zhao CLA 2010-11-11 01:46:21 EST
Created attachment 182875 [details]
patch

the patch mainly add a if judgment that if the partitions contains special type(e.g,org.eclipse.wst.css.STYLE),so there only is performance issue when there is a big piece css code that contains php code.

Thank Xu for finding the issue code!
Comment 15 xu jiaxi CLA 2010-11-11 01:56:41 EST
Hi zhao,
I failed to apply this patch.
There happened same conflicts.
Comment 16 Zhongwei Zhao CLA 2010-11-11 02:27:56 EST
Created attachment 182877 [details]
new patch

because this patch is created from branch,I will commit the code to head
Comment 17 Qiangsheng Wang CLA 2010-11-11 03:02:01 EST
(In reply to comment #16)
> Created an attachment (id=182877) [details]
> new patch
> 
> because this patch is created from branch,I will commit the code to head

Still the patch is against the branch code "retrieving revision 1.1.2.6".

Can you re-create one against the head code?
Comment 18 Roy Ganor CLA 2010-11-11 03:05:18 EST
(In reply to comment #17)
> (In reply to comment #16)
> > Created an attachment (id=182877) [details] [details]
> > new patch
> > 
> > because this patch is created from branch,I will commit the code to head
> 
> Still the patch is against the branch code "retrieving revision 1.1.2.6".
> 
> Can you re-create one against the head code?

We of course want this fix on branch as well, just need to understand if it performs ok (the iteration over all tokens is really needed?, can't we detect it when creating the regions?)

Many thanks!
Comment 19 Zhongwei Zhao CLA 2010-11-11 05:44:53 EST
Created attachment 182891 [details]
patch
Comment 20 Q.S. Wang CLA 2010-11-11 18:23:08 EST
Latest patch looks fine to me.
Comment 21 xu jiaxi CLA 2010-11-12 04:03:48 EST
Created attachment 182966 [details]
patch

against the head code
Comment 22 Zhongwei Zhao CLA 2010-11-15 02:52:18 EST
Created attachment 183104 [details]
patch for dltk
Comment 23 Zhongwei Zhao CLA 2010-11-15 03:16:17 EST
create Bug 330213 for dltk
Comment 24 Vladislav Kuzkokov CLA 2011-02-10 07:40:47 EST
*** Bug 330213 has been marked as a duplicate of this bug. ***
Comment 25 Piccio CLA 2011-02-10 09:24:12 EST
(In reply to comment #23)
> create Bug 330213 for dltk

How can I install this patch? Thanks.
Comment 26 daniphp CLA 2011-03-16 05:03:41 EDT
For me it works if I disable Preferences -> PHP -> Editor -> Syntax Coloring (string, keyword and PHPdoc) but the settings are not preserverd after a restart.
Comment 27 Stu CLA 2011-03-16 05:08:19 EDT
I too have no idea how to install patches. Please advise. Google is no help on this one.
Comment 28 daniphp CLA 2011-03-16 05:10:05 EDT
I don't think you can install patches. Only if you build eclipse from the begging.
Comment 29 Nicolas Bros CLA 2011-04-05 08:21:57 EDT
> How can I install this patch? Thanks.

- Import project "org.eclipse.dltk.core" from the Eclipse CVS (be careful to take the right version) : ":pserver:anonymous@dev.eclipse.org:/cvsroot/technology"
- Patch it
- Export the project into your install (Export > Deployable Plug-ins and Fragments > Install into host Repository)
Comment 30 Song M.S CLA 2011-04-12 01:50:32 EDT
5k+ line code very slow

eclipse 3.6 + PDT 2.2.1 

dldk patch, pdt patch apply , not changed. 

please fixed it !!!

I will crazy or use netBeans....

netBeans very fast but, code complete not good.
Comment 31 Stu CLA 2011-04-13 05:39:26 EDT
(In reply to comment #30)
> 5k+ line code very slow
> 
I just updated to Eclipse 3.6.2 and now editing seems reasonably fast for large PHP files of around 500-1000 lines. Much better than before. It gets quite difficult to work with files over 1000 lines due to the lag in typing, but this is now a low priority problem, for me, because we try not to keep files this large. It's just not good coding practice to have large files.
Comment 32 Zhongwei Zhao CLA 2011-04-14 02:30:28 EDT
*** Bug 332181 has been marked as a duplicate of this bug. ***
Comment 33 Dan Schaefer CLA 2011-04-21 10:05:32 EDT
(In reply to comment #31)
> (In reply to comment #30)
> > 5k+ line code very slow
> > 
> I just updated to Eclipse 3.6.2 and now editing seems reasonably fast for large
> PHP files of around 500-1000 lines. Much better than before.

Updating to Eclipse 3.6.2 did not solve the problem for me. 

I have not installed the patch(es) as I did not build Eclipse from scratch. Will those patches be available as updates soon? Or is there a repository I can add to install it using Eclipse?
Comment 34 James Cuzella CLA 2011-04-30 02:06:35 EDT
I am also being affected by this hideous bug, and have tried everything!  At first I thought it was due to editing files over NFS, or having my Eclipse workspace on an NFS mount.  However, after moving my files to the local machine, I still have terrible lag when editing files.

Simply commenting out a line by typing '//' takes at least 10-15 seconds!

Is there any way to get an update that includes these patches yet?
Comment 35 Nicolas Bros CLA 2011-04-30 05:14:35 EDT
(In reply to comment #34)
> Is there any way to get an update that includes these patches yet?

Most Eclipse plug-ins are built on hudson.eclipse.org. You can get the latest builds of PDT from:
https://hudson.eclipse.org/hudson/job/cbi-pdt-2.2-helios/

For example, you can get an update site built on march 21st here:
https://hudson.eclipse.org/hudson/job/cbi-pdt-2.2-helios/671/artifact/build/N201104210314/pdt-Update-N201104210314.zip

Then in Eclipse you do Help > Install New Software, click Add, click "Archive..." and select the update site zip.

The patch for dltk doesn't appear to have been committed though, so you have to apply it yourself if you want to use it:
- you need PDE which is not included in the "Eclipse PDT" bundle to build a plug-in, so you need to install it (in the same Eclipse as PDT) from "http://download.eclipse.org/releases/helios": install "Eclipse plug-in development environment" (in category "General Purpose Tools")
- checkout org.eclipse.dltk.core:
  - in the "CVS Repositories" view, add a repository with Host=dev.eclipse.org, Path=/cvsroot/technology, User=anonymous, Password=empty
  - in the tree, browse to org.eclipse.dltk/core/plugins/org.eclipse.dltk.core
  - right-click > Checkout
  - then back in the Navigator view, right click on the org.eclipse.dltk.core project, and do "Replace With > Another Branch Or Version", click "Refresh Tags", select the version that corresponds to the one in your install (Versions > v20100806-1245)
- then, apply the patch (Team > Apply Patch)
- finally, install it : Export > Deployable Plug-ins and Fragments, choose "Install into host Repository", click Finish
Comment 36 Otto Giesenfeld CLA 2011-05-05 11:07:45 EDT
I can confirm the comment of daniphp that the disabling of the entries String, Keyword, and PHPdoc in Preferences -> PHP -> Editor -> Syntax Coloring works around the problem.

With these settings, there are no excessive typing delays, but obviously, the syntax coloring is not complete.

Also, as mentioned by daniphp, the settings are not reapplied after a restart. In fact, one has to first reenable the coloring entries in the preferences dialog, apply these changes and then disable them again. But doing this is still a lot faster than typing even a few words when each letter causes a delay of several seconds.

When, for example, debugging and maintaining open-source PHP systems, it is not practically possible to control the file sizes (as one would first have to convince the project owners, etc), so whether or not one considers multi-thousand-line files sensible, this is an important issue.
Comment 37 Zhongwei Zhao CLA 2011-05-11 02:18:42 EDT
*** Bug 339100 has been marked as a duplicate of this bug. ***
Comment 38 bangou86 CLA 2011-08-16 18:18:59 EDT
Well, I just used pdt for the first time. First I used 2.2.0 32 bit from http://www.eclipse.org/pdt/downloads/ and I had terrible delays when typing.
Then I downloaded the 64 bit version from here http://www.eclipse.org/downloads/packages/eclipse-php-developers/heliosr but same problem.

Project consists of ~50 files, not more than 500 lines each.
Comment 39 dev CLA 2011-08-17 10:13:23 EDT
It's remarkable that this bug has not been addressed properly. Tweaking the java heap settings helps a little but does not solve the problems. IMO this type of response calls into question the viability of the entire project as an industry accepted solution.
Comment 40 dev CLA 2011-08-17 10:19:20 EDT
It's remarkable that this bug has not been addressed properly. Tweaking the java heap settings helps a little but does not solve the problems. IMO this type of response calls into question the viability of the entire project as an industry accepted solution.
Comment 41 Maciej Lisiewski CLA 2011-08-17 10:36:42 EDT
After 11 months of waiting I highly doubt many of the people are still waiting for the fix. I know I'm not - Aptana FTW. 
And it's not only that - project website is dead - no updates for over a year - no plans posted, no release schedule, not even about project page. 
Wiki is full of dead links, even on front page - download leads to 404, no entries in TODO list etc.
The nice graph we have on the top of the project page shows that number of commits dropped by 70% as compared to 2009.
Mailing list is mostly filled with notices from various automations of Eclipse project (failed builds, missing project pages, unmet release date reminders etc).
Comment 42 Brade CLA 2011-08-17 10:41:51 EDT
Indeed trying to develop in PHP with Eclipse has become a waste. I just started using Coda a few weeks ago, and am not looking back. It's a great app.
Comment 43 Otto Giesenfeld CLA 2011-08-17 11:12:20 EDT
There is actually a version 3.0.0 of PDT, available for Eclipse Indigo through the Help, Install New Software function.

As far as I can tell after having opened a few really large PHP files and typed at random but not having done anything purposeful, this particular bug is now gone.

There is still the annoying tendency upon typing to highlight with colored backgrounds seemingly random groups of characters in the vicinity of the cursor position, but that is a different matter and does not significantly affect the general usefulness of PDT. Also, the responsiveness, while now OK for any file size, is far from excellent when compared to other editors.

Eclipse with PDT is free and cross-platform, and it has a decent ability to cross-reference variables and functions. This makes it an excellent tool for maintenance and debugging work, as well as for plugin development for large code packages. (Apart from commercial products, I am unaware of other comparable solutions.) I understand that someone who programs PHP systems from scratch might prefer editors with better responsivness, though.
Comment 44 daniphp CLA 2011-08-17 11:38:40 EDT
Yes, very promising...
http://www.eclipse.org/downloads/php_package.php

Due to lack of a package maintainer for the Indigo release there will be no PHP (PDT) package.
Comment 45 bangou86 CLA 2011-08-17 23:08:14 EDT
Thanks for the hint, Otto! With 3.0, I only experience slight delays every now and then, everything works fine most of the time, finally.

The page structure of the eclipse website apparently is quite confusing and inconsistent tbh. There are three download locations now that I know of that give you different files or information, and only at http://www.eclipse.org/downloads/php_package.php it says the packages aren't maintained, and that you should manually install pdt.
Comment 46 Stu CLA 2011-08-18 02:13:42 EDT
(In reply to comment #42)
> Indeed trying to develop in PHP with Eclipse has become a waste. I just started
> using Coda a few weeks ago, and am not looking back. It's a great app.

I used Eclipse PDT for a couple of years to develop PHP and I recently discovered NetBeans 7.0 for PHP and let me tell you, it's awesome. The code completion is very smart compared to Eclipse, and the PHPUnit integration with code coverage is also very nice. Overall the IDE seems a lot lighter weight, more intuitive, and much more stable compared to Eclipse.
Comment 47 Dawid Pakula CLA 2015-01-30 07:15:41 EST
I cannot reproduce on latest nightly (large code base + file with 5k lines). 

So I'm marking as fixed.
Comment 48 Sylvia Tancheva CLA 2015-02-09 10:28:28 EST
Verified by typing into the tcpdf.php file (23+ K LOC). I do not see any performance issues. Closing