Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348837 - OleAutomation: unnecessary call to objIDispatch.GetTypeInfo in constructors which may cause bad performance
Summary: OleAutomation: unnecessary call to objIDispatch.GetTypeInfo in constructors w...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6.2   Edit
Hardware: PC Windows All
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-09 03:42 EDT by Dominik ölzl CLA
Modified: 2020-01-12 20:13 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 Dominik ölzl CLA 2011-06-09 03:42:53 EDT
org.eclipse.swt.ole.win32.OleAutomation:

In all constructors objIDispatch.GetTypeInfo is called unnecessary .(objITypeInfo is only accessed in methods getHelpFile, getDocumentation, getPropertyDescription, getFunctionDescription, getTypeInfoAttributes and getNames which are all hardly ever used by SWT itself)

e.g.:

OleAutomation(IDispatch idispatch) {
	if (idispatch == null) OLE.error(OLE.ERROR_INVALID_INTERFACE_ADDRESS);
	objIDispatch = idispatch;
	objIDispatch.AddRef();
	
	int /*long*/[] ppv = new int /*long*/[1];
	/* GetTypeInfo([in] iTInfo, [in] lcid, [out] ppTInfo) 
	 * AddRef has already been called on ppTInfo by the callee and must be released by the caller. 
	 */
	int result = objIDispatch.GetTypeInfo(0, COM.LOCALE_USER_DEFAULT, ppv);
	if (result == OLE.S_OK) {
		objITypeInfo = new ITypeInfo(ppv[0]);
	}
}


In some cases, e.g. if calling Variant.getAutomation (which constructs a new OleAutomation instance) to an object representing an IE 9 document mode's IHTMLElement the call to GetTypeInfo costs more than one millisecond (intel i5) which causes a huge performance impact when dealing with many objects.


Solution/Workaround: Don't call GetTypeInfo in constructory but evaluate and store it when it's needed.
Comment 1 Eclipse Genie CLA 2020-01-12 20:13:30 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.