The overhead is not in the instantiation, but in the actual call to the COM
object. The approach with one time instantiation in the TokenFilterFactory,
and the use of that object in the TokenFilter is exactly what I tried. There
is a factor of 10 performance gain when being able to do a single call
instead of token-by-token (also tried this in another environment (perl),
which gave the same result).

So I guess I'll need to do this with the other approach I suggested.

Bye,

Jaco.

2008/9/26 Chris Hostetter <[EMAIL PROTECTED]>

>
> : It is invoking a COM object in Windows. The object is instantiated once
> for
> : a token stream, and then invoked once for each token. The invoke always
> has
> : an overhead, not much to do about that (sigh...)
>
> I also know nothing about COM, but based on your comments it sounds like
> instantiating your COM object is expensive ... so why to it for every
> token?  why not have a TokenFilter where the COM object is constructed
> when the TokenFilter is constructed, and then the same object will be
> invoked for each token in the stream for a given field value.
>
> Or better still: if your COM object is threadsafe, construct one in the
> init method for your TokenFilterFactory and reuse it in every TokenFilter
> instance.
>
>
>
> -Hoss
>
>

Reply via email to