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

Bug 356524

Summary: Improve Generator Performance
Product: z_Archived Reporter: Brian Svihovec <svihovec>
Component: EDTAssignee: Project Inbox <edt.genframework-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: pharmon
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Brian Svihovec CLA 2011-09-01 16:22:11 EDT
While profiling EDT with YourKit, I noticed that the method AbstractVisitor::primGetMethod was taking a significant amount of time.  I believe this method takes so long because of the large number of MethodNotFound exceptions being thrown.

To resolve this issue, I changed the method to:

private Method primGetMethod(String methodName, Class<?> clazz) {
		Method method = null;
		try {
			Method[] methods = this.getClass().getMethods();
			for (Method nextMethod : methods) {
				if(nextMethod.getName().equals(methodName)){
					if(nextMethod.getParameterTypes().length == 1){
						if(nextMethod.getParameterTypes()[0].equals(clazz)){
							method = nextMethod;
							break;
						}
					}
				}
			}
		} catch (SecurityException e) {
			throw new RuntimeException(e);
		} 
		return method;
	}

In my runtime workspace, the generation time for 1 project went from 12 minutes to 3 minutes with this change.
Comment 1 Paul Harmon CLA 2011-09-06 08:45:52 EDT
I have committed and released your proposed change.
Comment 2 Lisa Lasher CLA 2011-11-09 14:16:59 EST
This defect was fixed at least 2 months ago, so I am closing.