But TokenWrapper is used there every time, it is not used for delegating,
only for exchanging the inner Token instance.

The delegation cost are there because a Filter implementing the old-API in
front of a new-API-Tokenizer would need to be wrapped 2 times: DocInverter
-> oldAPIFilter.incrementToken() [bw layer] -> oldAPIFilter.next(Token)
[native old-style impl] -> newAPIFilter.next(Token) [bw-layer] ->
newAPIFilter.incrementToken() [native new-style impl]

If both filters would only implement new API there would be direct calls
from the filter to the input TokenStream. If all streams/filters would
implement only the old API, the bw-delegation would only be used for the
incrementToken() calls from DocInverter.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de


> -----Original Message-----
> From: Michael Busch [mailto:busch...@gmail.com]
> Sent: Monday, August 10, 2009 9:58 PM
> To: java-dev@lucene.apache.org
> Subject: Re: who clears attributes?
> 
> On 8/10/09 12:52 PM, Uwe Schindler wrote:
> > Michael: The TokenWrapper added cost was there in 2.9 before the
> TokenStream
> > overhaul, too, as the TokenWrapper-like code was there implemented
> > similarily inside DocInverter.
> >
> >
> 
> You're right. It will only be more costly in case you mix multiple old
> and new TokenStreams in a chain. Then the delegation is done more than
> once.
> 
>   Michael
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-dev-h...@lucene.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to