COMatePLUS represents quite a jump forward over earlier versions of COMate, both in terms of it's internal workings and the facilities offered to the developer when working with automation servers. These changes were motivated by a desire to allow much faster access to COM methods/properties than was currently available through COMate's existing command processor.
COMatePLUS can process 'strings' of 'closely related' method/property calls far far faster than earlier versions of COMate, although you do have to specifically make use of the new facilities in order to take advantage of any possible speed increases etc.
Earlier versions of COMate, when given a command string as part of a method/property call, would first undertake the sometimes lengthy process of tokenising and parsing the command string looking for method calls, parameter types, type modifiers ...... etc. and only when this process was complete would it consider executing the COM method etc. When the COM method finished its work, the results of all that tokenising and parsing would be discarded, meaning that if the same method/property needed to be called again (perhaps with modified parameters) then the processing of the command string would need to be undertaken again!
A somewhat wasteful affair don't you think?
COMatePLUS takes a different approach, one inspired by SQLite's use of 'prepared statements' etc.
Basically, COMatePLUS allows you to pre-compile a command string right down to a level suitable for passing directly to a COM server. The result of this compilation is what I have termed a COMatePLUS statement which can be executed at any time and as many times (against different COMate objects if required) as required etc. Parameters can be altered between calls very quickly.
The important thing is that the original COMateObject class now uses these pre-compiled statements 'behind the scenes' and so all existing COMate based code should run fine with COMatePLUS with no modifications whatsoever. Of course, all existing code will not run any faster; only code specifically making use of these prepared statements can benefit from these changes.
A couple of newly added demo programs written to showcase COMatePLUS' prepared statements show a 10-fold increase in speed on my system, -something which is not to be sniffed at!
The following functions have been added by COMatePLUS for working with prepared statements (see the relevant sections of this manual for details) :
1. COMate_PrepareStatement()
2. COMate_GetStatementParameter()
3. COMate_FreeStatementHandle()
In addition, a new method has been added to the COMateObject class :
GetCOMObject()
which is, in a sense, the reverse of the COMate_WrapCOMObject() function.
All of the COMateObject class methods dealing with calling COM methods/properties have also been modified by the addition of an optional parameter in which we can pass a COMatePLUS statement handle etc. See the COMateObject class section of this manual for details.
Other alterations to the COMate library.
You can now also opt to remove all error reporting from your COMatePLUS application. Simply define the constant #COMATE_NOERRORREPORTING = 1 at the top of your source, before including the main COMatePLUS source file.
Partager