You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Tzvika Barenholz <tz...@gmail.com> on 2007/11/18 21:12:29 UTC

some minor fixes

Hello good people of Lucene!

I've been using Lucene for a long while, but have only recently had occasion
to checkout the source code from the trunk and build it myself. When I did
so, I was alerted by my IDE (IDEA) of a large number of irregularities in
the code, some of them serious, most not. I made a patch containing some of
the obvious fixes: StringBuffer.append in stead of concatenation, Boolean
static instances instead of construction, System.arraycopy() in stead of
loops to the same effect, and Integer.toString in stead of unnecessary
construction. Minor things, to be sure, but still I thought it best to share
the diff, if you guys should think it worth committing. I did verify that
the ant common.test target passes after the change, which, unsurprisingly,
it did.

I should note that there were many many other thing that I did not change,
for the reason that they would have made an inconveniently large patch. For
example: many methods in Lucense are redundantly declared as "private
final"; many fields can be converted into local variables with the same
functionality. In some  cases strings are compared with string literals
using ==. I can give a list if anyone thinks he or she will have use for it.

That's it. Good  night and keep up the good work!
Tzvika

RE: some minor fixes

Posted by Uwe Schindler <uw...@thetaphi.de>.
> functionality. In someĀ  cases strings are compared with string literals
> using ==. I can give a list if anyone thinks he or she will have use for
> it. 

This is a speed optimization. All Strings compared by this function were
"interned" before. This is done for e.g. all "field" names in Lucene. On
constructing a Term, the filed name is "interned" by field.intern(). After
that, the returned sting object is a reference to a unique representation in
a string pool maintained by Java.

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#intern()

Uwe


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


Re: some minor fixes

Posted by Tzvika Barenholz <tz...@gmail.com>.
Trying again, this time zipped.
T

On 11/19/07, Uwe Schindler <uw...@thetaphi.de> wrote:
>
> Where is the patch, that fixes your problems. Your message did not have an
> attachment!
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
>   _____
>
> From: Tzvika Barenholz [mailto:tzvika.barenholz@gmail.com]
> Sent: Monday, November 19, 2007 8:24 AM
> To: java-dev@lucene.apache.org
> Subject: Re: some minor fixes
>
>
>
> Hi Michael!
>
> The patch is attached to my previous message (and this one too). It
> doesn't
> actually fix an issue, so I don't see where to put it otherwise. Please
> advise. *trying not to be difficult* :-)
>
> T
>
> On 11/18/07, Michael McCandless <lu...@mikemccandless.com> wrote:
>
>
> Thank you!  Yes please submit a patch and we can iterate from there.
>
> Mike
>
> "Tzvika Barenholz" <tz...@gmail.com> wrote:
> > Hello good people of Lucene!
> >
> > I've been using Lucene for a long while, but have only recently had
> occasion
> > to checkout the source code from the trunk and build it myself. When I
> did
> > so, I was alerted by my IDE (IDEA) of a large number of irregularities
> in
> > the code, some of them serious, most not. I made a patch containing some
> of
> > the obvious fixes: StringBuffer.append in stead of concatenation,
> Boolean
> > static instances instead of construction, System.arraycopy () in stead
> of
> > loops to the same effect, and Integer.toString in stead of unnecessary
> > construction. Minor things, to be sure, but still I thought it best to
> share
> > the diff, if you guys should think it worth committing. I did verify
> that
> > the ant common.test target passes after the change, which,
> unsurprisingly,
> > it did.
> >
> > I should note that there were many many other thing that I did not
> change,
> > for the reason that they would have made an inconveniently large patch.
> For
> > example: many methods in Lucense are redundantly declared as "private
> > final"; many fields can be converted into local variables with the same
> > functionality. In some  cases strings are compared with string literals
> > using ==. I can give a list if anyone thinks he or she will have use for
> > it.
> >
> > That's it. Good  night and keep up the good work!
> > Tzvika
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
> <ma...@lucene.apache.org>
>
>
>
>

RE: some minor fixes

Posted by Uwe Schindler <uw...@thetaphi.de>.
Where is the patch, that fixes your problems. Your message did not have an
attachment!

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

  _____  

From: Tzvika Barenholz [mailto:tzvika.barenholz@gmail.com] 
Sent: Monday, November 19, 2007 8:24 AM
To: java-dev@lucene.apache.org
Subject: Re: some minor fixes

 

Hi Michael! 

The patch is attached to my previous message (and this one too). It doesn't
actually fix an issue, so I don't see where to put it otherwise. Please
advise. *trying not to be difficult* :-)
 
T

On 11/18/07, Michael McCandless <lu...@mikemccandless.com> wrote:


Thank you!  Yes please submit a patch and we can iterate from there.

Mike

"Tzvika Barenholz" <tz...@gmail.com> wrote:
> Hello good people of Lucene! 
>
> I've been using Lucene for a long while, but have only recently had
occasion
> to checkout the source code from the trunk and build it myself. When I did
> so, I was alerted by my IDE (IDEA) of a large number of irregularities in 
> the code, some of them serious, most not. I made a patch containing some
of
> the obvious fixes: StringBuffer.append in stead of concatenation, Boolean
> static instances instead of construction, System.arraycopy () in stead of
> loops to the same effect, and Integer.toString in stead of unnecessary
> construction. Minor things, to be sure, but still I thought it best to
share
> the diff, if you guys should think it worth committing. I did verify that 
> the ant common.test target passes after the change, which, unsurprisingly,
> it did.
>
> I should note that there were many many other thing that I did not change,
> for the reason that they would have made an inconveniently large patch.
For 
> example: many methods in Lucense are redundantly declared as "private
> final"; many fields can be converted into local variables with the same
> functionality. In some  cases strings are compared with string literals 
> using ==. I can give a list if anyone thinks he or she will have use for
> it.
>
> That's it. Good  night and keep up the good work!
> Tzvika

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

 


Re: some minor fixes

Posted by Tzvika Barenholz <tz...@gmail.com>.
Duly noted. I created https://issues.apache.org/jira/browse/LUCENE-1059

Tzvika

On 11/19/07, Grant Ingersoll <gs...@apache.org> wrote:
>
> Sure it fixes an issue.  I think a JIRA issue is the best way to make
> sure this doesn't get lost.
>
> -Grant
>
> On Nov 19, 2007, at 2:23 AM, Tzvika Barenholz wrote:
>
> > Hi Michael!
> >
> > The patch is attached to my previous message (and this one too). It
> > doesn't actually fix an issue, so I don't see where to put it
> > otherwise. Please advise. *trying not to be difficult* :-)
> >
> > T
> >
> > On 11/18/07, Michael McCandless <lu...@mikemccandless.com> wrote:
> >
> > Thank you!  Yes please submit a patch and we can iterate from there.
> >
> > Mike
> >
> > "Tzvika Barenholz" <tz...@gmail.com> wrote:
> > > Hello good people of Lucene!
> > >
> > > I've been using Lucene for a long while, but have only recently
> > had occasion
> > > to checkout the source code from the trunk and build it myself.
> > When I did
> > > so, I was alerted by my IDE (IDEA) of a large number of
> > irregularities in
> > > the code, some of them serious, most not. I made a patch
> > containing some of
> > > the obvious fixes: StringBuffer.append in stead of concatenation,
> > Boolean
> > > static instances instead of construction, System.arraycopy () in
> > stead of
> > > loops to the same effect, and Integer.toString in stead of
> > unnecessary
> > > construction. Minor things, to be sure, but still I thought it
> > best to share
> > > the diff, if you guys should think it worth committing. I did
> > verify that
> > > the ant common.test target passes after the change, which,
> > unsurprisingly,
> > > it did.
> > >
> > > I should note that there were many many other thing that I did not
> > change,
> > > for the reason that they would have made an inconveniently large
> > patch.  For
> > > example: many methods in Lucense are redundantly declared as
> > "private
> > > final"; many fields can be converted into local variables with the
> > same
> > > functionality. In some  cases strings are compared with string
> > literals
> > > using ==. I can give a list if anyone thinks he or she will have
> > use for
> > > it.
> > >
> > > That's it. Good  night and keep up the good work!
> > > Tzvika
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-dev-help@lucene.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-dev-help@lucene.apache.org
>
> --------------------------
> Grant Ingersoll
> http://lucene.grantingersoll.com
>
> Lucene Helpful Hints:
> http://wiki.apache.org/lucene-java/BasicsOfPerformance
> http://wiki.apache.org/lucene-java/LuceneFAQ
>
>
>
>

Re: some minor fixes

Posted by Grant Ingersoll <gs...@apache.org>.
Sure it fixes an issue.  I think a JIRA issue is the best way to make  
sure this doesn't get lost.

-Grant

On Nov 19, 2007, at 2:23 AM, Tzvika Barenholz wrote:

> Hi Michael!
>
> The patch is attached to my previous message (and this one too). It  
> doesn't actually fix an issue, so I don't see where to put it  
> otherwise. Please advise. *trying not to be difficult* :-)
>
> T
>
> On 11/18/07, Michael McCandless <lu...@mikemccandless.com> wrote:
>
> Thank you!  Yes please submit a patch and we can iterate from there.
>
> Mike
>
> "Tzvika Barenholz" <tz...@gmail.com> wrote:
> > Hello good people of Lucene!
> >
> > I've been using Lucene for a long while, but have only recently  
> had occasion
> > to checkout the source code from the trunk and build it myself.  
> When I did
> > so, I was alerted by my IDE (IDEA) of a large number of  
> irregularities in
> > the code, some of them serious, most not. I made a patch  
> containing some of
> > the obvious fixes: StringBuffer.append in stead of concatenation,  
> Boolean
> > static instances instead of construction, System.arraycopy () in  
> stead of
> > loops to the same effect, and Integer.toString in stead of  
> unnecessary
> > construction. Minor things, to be sure, but still I thought it  
> best to share
> > the diff, if you guys should think it worth committing. I did  
> verify that
> > the ant common.test target passes after the change, which,  
> unsurprisingly,
> > it did.
> >
> > I should note that there were many many other thing that I did not  
> change,
> > for the reason that they would have made an inconveniently large  
> patch.  For
> > example: many methods in Lucense are redundantly declared as  
> "private
> > final"; many fields can be converted into local variables with the  
> same
> > functionality. In some  cases strings are compared with string  
> literals
> > using ==. I can give a list if anyone thinks he or she will have  
> use for
> > it.
> >
> > That's it. Good  night and keep up the good work!
> > Tzvika
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org

--------------------------
Grant Ingersoll
http://lucene.grantingersoll.com

Lucene Helpful Hints:
http://wiki.apache.org/lucene-java/BasicsOfPerformance
http://wiki.apache.org/lucene-java/LuceneFAQ




Re: some minor fixes

Posted by Tzvika Barenholz <tz...@gmail.com>.
Hi Michael!

The patch is attached to my previous message (and this one too). It doesn't
actually fix an issue, so I don't see where to put it otherwise. Please
advise. *trying not to be difficult* :-)

T

On 11/18/07, Michael McCandless <lu...@mikemccandless.com> wrote:
>
>
> Thank you!  Yes please submit a patch and we can iterate from there.
>
> Mike
>
> "Tzvika Barenholz" <tz...@gmail.com> wrote:
> > Hello good people of Lucene!
> >
> > I've been using Lucene for a long while, but have only recently had
> occasion
> > to checkout the source code from the trunk and build it myself. When I
> did
> > so, I was alerted by my IDE (IDEA) of a large number of irregularities
> in
> > the code, some of them serious, most not. I made a patch containing some
> of
> > the obvious fixes: StringBuffer.append in stead of concatenation,
> Boolean
> > static instances instead of construction, System.arraycopy() in stead of
> > loops to the same effect, and Integer.toString in stead of unnecessary
> > construction. Minor things, to be sure, but still I thought it best to
> share
> > the diff, if you guys should think it worth committing. I did verify
> that
> > the ant common.test target passes after the change, which,
> unsurprisingly,
> > it did.
> >
> > I should note that there were many many other thing that I did not
> change,
> > for the reason that they would have made an inconveniently large
> patch.  For
> > example: many methods in Lucense are redundantly declared as "private
> > final"; many fields can be converted into local variables with the same
> > functionality. In some  cases strings are compared with string literals
> > using ==. I can give a list if anyone thinks he or she will have use for
> > it.
> >
> > That's it. Good  night and keep up the good work!
> > Tzvika
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>

Re: some minor fixes

Posted by Michael McCandless <lu...@mikemccandless.com>.
Thank you!  Yes please submit a patch and we can iterate from there.

Mike

"Tzvika Barenholz" <tz...@gmail.com> wrote:
> Hello good people of Lucene!
> 
> I've been using Lucene for a long while, but have only recently had occasion
> to checkout the source code from the trunk and build it myself. When I did
> so, I was alerted by my IDE (IDEA) of a large number of irregularities in
> the code, some of them serious, most not. I made a patch containing some of
> the obvious fixes: StringBuffer.append in stead of concatenation, Boolean
> static instances instead of construction, System.arraycopy() in stead of
> loops to the same effect, and Integer.toString in stead of unnecessary
> construction. Minor things, to be sure, but still I thought it best to share
> the diff, if you guys should think it worth committing. I did verify that
> the ant common.test target passes after the change, which, unsurprisingly,
> it did.
> 
> I should note that there were many many other thing that I did not change,
> for the reason that they would have made an inconveniently large patch.  For
> example: many methods in Lucense are redundantly declared as "private
> final"; many fields can be converted into local variables with the same
> functionality. In some  cases strings are compared with string literals
> using ==. I can give a list if anyone thinks he or she will have use for
> it.
> 
> That's it. Good  night and keep up the good work!
> Tzvika

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