Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 9173 invoked from network); 6 Jun 2008 05:43:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Jun 2008 05:43:56 -0000 Received: (qmail 84812 invoked by uid 500); 6 Jun 2008 05:43:58 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 84507 invoked by uid 500); 6 Jun 2008 05:43:57 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 84496 invoked by uid 99); 6 Jun 2008 05:43:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jun 2008 22:43:56 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of alexey.v.varlamov@gmail.com designates 74.125.46.157 as permitted sender) Received: from [74.125.46.157] (HELO yw-out-1718.google.com) (74.125.46.157) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Jun 2008 05:43:07 +0000 Received: by yw-out-1718.google.com with SMTP id 5so614018ywr.0 for ; Thu, 05 Jun 2008 22:43:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=wnKwPnlsHxAk1UxFvn7oYk/VvegSDu4r1QaKhmbKkxY=; b=mBMKzWe1D88cqsvZPWu+VEkfD65bjBVQmeOnrH+KTeMtYR+UD5JtS0McTUYbHinMqI 6v8voE7BHYiZn3/ooFmPvrbKghHp6zL5kyR2uKvjT1nt+Le4FlvHY6neZs2Tqwign139 tQ5W1kGFkTRMVUX5Dohjjuneojfle0I6c4VcM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=g8f+9cdNFuYYdTd/yBMpwgAmmbXaOHDOaJb7G49D0aRGmsDfG5PtrhM4VXg5XVLM6S IEK6YkAgA8motlA2aJv0gXdbn5S3lutznSrHFxy/o2hRGH/4MYRtacKfOp+AdfGAH2Zj 9v1epNa7gz1Lnrnlchzzklfa0336h0lX1gK5A= Received: by 10.150.79.22 with SMTP id c22mr2832864ybb.160.1212731003984; Thu, 05 Jun 2008 22:43:23 -0700 (PDT) Received: by 10.150.204.15 with HTTP; Thu, 5 Jun 2008 22:43:23 -0700 (PDT) Message-ID: Date: Fri, 6 Jun 2008 12:43:23 +0700 From: "Alexey Varlamov" To: dev@harmony.apache.org Subject: Re: My first submission! java.lang.ThreadLocal In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Checked: Checked by ClamAV on apache.org Hi Bob, Thanks for the contribution, and welcome on board! There is one more thing you need to do for proceeding further: please ensure you've filled an Authorized Contributor Questionnaire [1,2] and submit signed scanned form to PMC (private@ list). [1] http://harmony.apache.org/contribution_policy.html [2] http://harmony.apache.org/auth_cont_quest.html You may get more help with build errors if posted relevant details here. AFAIS you're building on MacOS, I'm not sure what is current porting status of classlib. And almost certainly DRLVM would need some work to build there, but it should not be much. We've already heard a success story about launching DRLVM with interpreter on FreeBSD, so give it a try ;) . Regards, Alexey 2008/6/6, Bob Lee : > I've addressed two bugs: > > https://issues.apache.org/jira/browse/HARMONY-2298 > https://issues.apache.org/jira/browse/HARMONY-5703 > > I attached my patch to the latter. I'm sorry it doesn't build in Harmony out > of the box, but I ran into a compile error in native code and couldn't wait > to submit this. I'm still trying to get acquainted with the Harmony build > but have been impressed by its user friendliness so far. > > This ThreadLocal implementation runs as fast and scales as well as the RI. I > ran Doug Lea's own ThreadLocal performance test suite against it. > > This impl is particularly memory efficient compared to the RI and it even > cleans up after reclaimed ThreadLocals more aggressively. Here's the memory > break down by thread for N live entries: > > RI (educated guesses, obviously not based on looking at their code): > > - Table of length L > N > - N entry objects (doubles as weak reference) > - 4 bytes for array entry in table > - 28 bytes for entry object > - Expands table when 2/3 full > > crazybob's: > > - Table of length (L > N) * 2 > - 8 bytes per entry > - Expands table when 1/2 full > > For a table w/ 16 slots (the default): > > One live entry: > RI: 60 bytes/thread > crazybob's: 128 bytes/thread > > 8 live entries: > RI: 288 bytes/thread > crazybob's: 128 bytes/thread > > 9 live entries (forces expansion in crazybob's): > RI: 316 bytes/thread > crazybob's: 256 bytes/thread > > 16 live entries: > RI: 576 bytes/thread > crazybob's: 256 bytes/thread > > crazybob's implementation allocates no objects during normal operations, so > there's no allocations and no garbage collection overhead. > > Hope you enjoy, > Bob >