lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Engels" <reng...@ix.netcom.com>
Subject RE: Multiple threads searching in Lucene and the synchronized issue. -- solution attached.
Date Wed, 10 May 2006 04:46:17 GMT
I wrote a test case to test the performance (assuming that it worked, but
based on reading the double-checked articles I understand the dilemma).

Using 30,000,000 simple iterations and 2 threads: (note this is on a single
processor machine).

sync time = 39532
unsync time = 2250
diff time = 37282
diff per iteration = 6.213666666666667E-4

So it saves .0006 ms per invocation of the method.

I honestly doubt this is the cause of any performance bottleneck.

I attached the test code if you are interested.



-----Original Message-----
From: yueyu lin [mailto:popeyelin@gmail.com]
Sent: Tuesday, May 09, 2006 11:32 PM
To: java-dev@lucene.apache.org
Subject: Re: Multiple threads searching in Lucene and the synchronized
issue. -- solution attached.


I met these problem before indeed.The compiler did something optimized for
me that was bad for me when I see the byte-codes.
 When I'm using a function local variable, m_indexTerms and in JDK1.5.06, it
seems ok.
Whether it will break in other environments, I still don't know about it.
On 5/10/06, Yonik Seeley <yseeley@gmail.com> wrote:
>
> On 5/9/06, Robert Engels <rengels@ix.netcom.com> wrote:
> > I am fairly certain his code is ok, since it rechecks the initialized
> state
> > in the synchronized block before initializing.
>
> That "recheck" is why the pattern (or anti-pattern) is called
> double-checked locking :-)
>
> -Yonik
> http://incubator.apache.org/solr Solr, the open-source Lucene search
> server
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>


--
--
Yueyu Lin

Mime
View raw message