There are some differences in how the Curl RTE does COM calls,
Visual Basic uses the COM types and COM methods directly, where
the ActiveXObject class uses IDispatch::Invoke.  This means that
the ActiveXObject class is doing more work converting things to
and from VARIANTs as well as the COM code has to look up methods.
Also depending on how the ActiveX code in Excel is written, if it
returns new IUnknowns each time an object is requested that will
slow things down because the Curl RTE ends up needing to re-lookup
what methods and properties it has.

So, while the Curl language code probably can not be as fast as
the VB code, there are several things that you can do to speed up
your code.

1) Save intermediate values that are reused, in particular in your sample
{self.w_typRD.get-value self.w_lngRDCount} is done lots and lots of times,
save that value in a variable and use that variable.  Similarly for each
field you fetch it once to compare and once to save it, save that in
a variable.
2) Use ActiveXObject as the type for any object that is an ActiveXObject.
This will avoid the overhead of 'any' calls.  (So change:
      {let with-1:any = self.xlSheetReport}
to be 
      let with-1:ActiveXObject = self.xlSheetReport
And I suspect although I am not sure that you should be doing:
    let rd-value:ActiveXObject =
        {self.w_typRD.get-value self.w_lngRDCount} asa ActiveXObject
(assuming that that is an ActiveXObject.)

I suspect that this stuff could be optimized, to not be doing those
{Variant-to-Boolean {vb-var-diff ...}}
but I am not sure what it is doing, so I am not sure if that is true.
If those values are just strings or integers or some such then you can
just compare them in the Curl language code.  And in any case you could
probably skip using Variants some how.

This is also strange:
       {set {with-1.Cells self.w_lngRDLine, 10}.Value = {{proc {}:String 
byref-1:{FastArray-of String} = {{FastArray-of String} {self.w_typRD.get-value  
                                                              let ret:String = 
{substrDateChange byref-1, {{FastArray-of String} "g#e.#m.#d"}}
{self.w_typRD.get-value  self.w_lngRDCount}.KAISHI_YMD = byref-1[0]}
                                                              {return ret}}}}

You can just use {value} instead of an inline proc.  And you can
use Pointer-to or Reference-to (if on 6.0) instead of the FastArray-of.
But it also looks like you don't need a to do any of that stuff by
reference, you can just return two values from {substrDateChange}.  And
the second argument for substrDateChange doesn't look like it needs to
be by reference in any case.
So you could have something like:
    let rd-value:ActiveXObject =
        {self.w_typRD.get-value  self.w_lngRDCount} asa ActiveXObject
    set {with-1.Cells self.w_lngRDLine, 10}.Value =
            let (ret:String, replacement-ymd:String) =
                {substrDateChange rd-value.KAISHI_YMD, "g#e.#m.#d"}
            set rd-value.KAISHI_YMD = replacement-ymd

William Bardwell

Reply via email to