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

Bug 185050

Summary: [rename] performance issue with in place rename - many local references
Product: [Eclipse Project] JDT Reporter: Benno Baumgartner <benno.baumgartner>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: CLOSED DUPLICATE QA Contact:
Severity: minor    
Priority: P3 CC: daniel_megert, deepakazad
Version: 3.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
screen shot none

Description Benno Baumgartner CLA 2007-05-02 05:29:37 EDT
I20070502-0010

Given (the not very common class):
package test1;
public class E01 {
	public void bar() {
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
		foo();foo();foo();foo();foo();foo();
	}
	
	public void foo() {}

}
1. Select 'foo' in method declaration of foo
2. Ctrl-1
3. Rename in file
4. type 'foobar'
Is: 
 It is slow but acceptable for this corner case
5. Ctrl-Z
6. Alt-Shift-R
7. Type 'foobar'
Is:
 It is slower then the local rename, also the 'in place dialog' is not correctly redrawn, see screen shot.
Should:
 Be faster (if possible), not produce cheese on screen
Comment 1 Benno Baumgartner CLA 2007-05-02 05:29:57 EDT
Created attachment 65582 [details]
screen shot
Comment 2 nikolaus heger CLA 2007-07-24 00:42:01 EDT
I noticed extreme slowness with in place rename on the Mac OS X version of Eclipse 3.3 independently but I think it's the same bug so I tried the test case given:

When I use in-place-rename to rename foo() to foo1(), it takes about 20 seconds. Renaming it to anything else takes 20 seconds for each keystroke. During this time Eclipse is frozen - spinning beach ball. 

The CPU is only at 20% for Eclipse at the same time - it's not maxed out.

This is on a MacBook Pro 2.2GHz with 4GB RAM and Eclipse using 300MB out of a maximum of 512MB.

Can we up the priority on this?

I noticed this is very slow in a real-world case as below. I modified it slightly to remove dependencies so it's now rather nonsensical, but the logic is from a real-world application:

public boolean osxTest() {
            Object renameThis = "foo"; // <--------- RENAME THIS VARIABLE IN PLACE on OS X, witness extreme slowness
            if (renameThis == null) { // no entry - dirty
                return true;
            } else { 
                if (renameThis instanceof Integer) {
                    if ( ((Integer)renameThis).intValue() == application) {
                        // not dirty
                        return false;
                    } else {
                        // another app
                        ArrayList l = new ArrayList(2);
                        l.add(renameThis);
                        l.add(new Integer(1));
                        return true;
                    }
                } else if (renameThis instanceof ArrayList) { // @todo: this is expected to be the most common case, optimize for that
                    ArrayList list = (ArrayList) renameThis;
                    Integer app = new Integer(1);
                    if (list.contains(app)) {
                        return false;
                    } else {
                        list.add(app);
                        return true;
                    }
                }
                return false;
            }

        }
Comment 3 Markus Keller CLA 2010-06-30 09:06:55 EDT

*** This bug has been marked as a duplicate of bug 289655 ***