Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356524 - Improve Generator Performance
Summary: Improve Generator Performance
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-01 16:22 EDT by Brian Svihovec CLA
Modified: 2017-02-23 14:19 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.