lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eks dev <eks...@yahoo.co.uk>
Subject Re: Ideas to refactor Filed
Date Tue, 11 Mar 2008 10:49:18 GMT
Moin Moin Michael, 

for the first issue I have crated LUCENE-1217, and for the second one I have some questions.

if we maintain length and offset internally in Field than we have one, imo, theoretical "legacy
performance problem" as we need to 
create new byte[length] and copy in order to preserve compatibility (users expect this method
to return compact array with 0 offset)
I am talking about. 
public byte[] binaryValue();

would that be acceptable, it is very small penalty and there will be a way to avoid it? Anyhow,
if one is using 
public void setValue(byte[] value), it is to be expected that this user allready has a reference
to value.  This makes this 
question rather theoretical, no?

we could than create new methods,  getOffset() getLength() getBinaryValue() that enable full
spectrum and replace all uses that expect 0-offset array.





----- Original Message ----
From: Michael McCandless <lucene@mikemccandless.com>
To: java-dev@lucene.apache.org
Sent: Wednesday, 5 March, 2008 10:09:26 AM
Subject: Re: Ideas to refactor Filed


Good morning!

eks dev wrote:

> I have noticed the two potential enhancements in Field, and I am  
> not sure if I read it correctly, so better to ask before crating  
> Jira issue :)
>
> 1.. Field uses two methods to determine type of fieldsData,  
> sometimes with boolean isBinary; and sometimes with instanceof byt[]
> The proposal is to reduce it to one method, ether by removing   
> isBinary and using instance of byte[] or to replace one instanceof  
> with isBinary. I do not know which one should be faster?

This makes sense.  Is this for the binaryValue() method?  I would  
expect the explicit isBinary would be fastest.

> 2. Second enhancement would be to add length of char[]/byte[], to  
> setValue(...) methods e.g.
> public void setValue(byte[] value, int length)  //maybe offset as  
> well?
> This would enable users to save some allocations

This also makes sense.  I think adding offset and length makes sense.

Mike

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






      ___________________________________________________________ 
Rise to the challenge for Sport Relief with Yahoo! For Good  

http://uk.promotions.yahoo.com/forgood/


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


Mime
View raw message