Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 14036 invoked from network); 22 Apr 2008 17:03:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Apr 2008 17:03:01 -0000 Received: (qmail 77350 invoked by uid 500); 22 Apr 2008 17:03:00 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 77327 invoked by uid 500); 22 Apr 2008 17:03:00 -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 77316 invoked by uid 99); 22 Apr 2008 17:03:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Apr 2008 10:03:00 -0700 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: 195.212.29.141 is neither permitted nor denied by domain of mark.hindess@googlemail.com) Received: from [195.212.29.141] (HELO mtagate8.uk.ibm.com) (195.212.29.141) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Apr 2008 17:02:05 +0000 Received: from d06nrmr1407.portsmouth.uk.ibm.com (d06nrmr1407.portsmouth.uk.ibm.com [9.149.38.185]) by mtagate8.uk.ibm.com (8.13.8/8.13.8) with ESMTP id m3MH2PHk086324 for ; Tue, 22 Apr 2008 17:02:25 GMT Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by d06nrmr1407.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id m3MH2PxD2224358 for ; Tue, 22 Apr 2008 18:02:25 +0100 Received: from d06av01.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m3MH2O3t017066 for ; Tue, 22 Apr 2008 17:02:25 GMT Received: from anaheim.local (sig-9-145-119-47.uk.ibm.com [9.145.119.47]) by d06av01.portsmouth.uk.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m3MH2OZV017051 for ; Tue, 22 Apr 2008 17:02:24 GMT Message-Id: <200804221702.m3MH2OZV017051@d06av01.portsmouth.uk.ibm.com> X-Mailer: exmh version 2.7.2 01/07/2005 (debian 1:2.7.2-9) with nmh-1.2 In-reply-to: <4bebff790804220423l559b29b9ye2762a45b3369604@mail.gmail.com> References: <4bebff790804181153w61231384y436c4c4aa9500ba4@mail.gmail.com> <728dc7fa0804181201n9debd8i4ea43f1e95bf236f@mail.gmail.com> <480C8D85.8040705@gmail.com> <4bebff790804210552k13ed10a1u1a0daf4d43e33c43@mail.gmail.com> <480D9D3D.6080408@gmail.com> <4bebff790804220423l559b29b9ye2762a45b3369604@mail.gmail.com> Comments: In-reply-to "Aleksey Shipilev" message dated "Tue, 22 Apr 2008 15:23:40 +0400." From: Mark Hindess To: dev@harmony.apache.org Subject: Re: [classlib][luni][performance] IdentityHashMap implementation Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 22 Apr 2008 18:02:19 +0100 X-Virus-Checked: Checked by ClamAV on apache.org On 22 April 2008 at 15:23, "Aleksey Shipilev" wrote: > Tim, > > I support your proposal and try to make distinction between > proof-of-concept and clean patches. > > Performance improvements could be notorious work, requiring a lot of > resources. The bad thing is, they could give nothing after the work is > done, that's why we are doing thought experiments and proof-of-concept > patches before actually implementing something. Proof-of-concept may > also give a hint on what maximum improvement we can get and set the > expectations for clean patch. > > So we are not looking for hiding the problems, rather we're exploring > what could it worth. > > F.ex. the experiments on IdentityHashMap performance finally led to > clean, non-breaking, consistent implementation, ready to be committed > patch [1]. Can we focus on reviewing it? "clean [snip] patch"? Okay, I'll take the bait... 1) It is good to fix the assert in the test case, but if you are going to change it at all you might as well replace: assertTrue("TestB. removed entries incorrectly", map.size() == 11 && !result); with: assertEquals("TestB. removed entries incorrectly, size is not correct", 11, map.size()); assertFalse("TestB. removed entries incorrectly, result is not correct", result); 2) I think the IdentityHashMap javadoc comment change removes too much important information. 3) I don't understand why you make arbitrary whitespace changes - such as rewriting: public class IdentityHashMap extends AbstractMap implements Map, Serializable, Cloneable { to be longer than 80-characters. 4) You rename DEFAULT_MAX_SIZE to DEFAULT_SIZE but I don't really see the relevance of this to the changes. 5) You seem to remove a number of correct comments from the declarations of threshold, DEFAULT_MAX_SIZE, loadFactor, and modCount. I almost I gave up reading the patch at this point out of frustration at the number of irrelevant changes. Such as: a) the re-ordering of often unchanged public methods - previously the public methods were grouped by similar functionality which seems logical to me but now they are in alphabetical order. This makes the patch much bigger and harder to read. If there is a good reason to re-order the methods, do it in a separate patch. b) The arbitrary changes to javadoc like: /** - * Searches this Map for the specified value. - * - * + * Searches this IdentityHashMap for the specified value. + * * @param value * the object to search for - * @return true if value is a value of this Map, false + * @return true if value is a value of this IdentityHashMap, false * otherwise */ c) The arbitrary renaming of IdentityHashMapEntry to Entry. Is it unrealistic to expect clean patches with justifications for changes? Can we optimise patches as well as code? If I apply the patch and then revert the whitespace changes, javadoc reformatting, renaming of DEFAULT_MAX_SIZE, renaming of IdentityHashMapEntry, etc. the the resulting svn diff contains at least 33% fewer +/- lines than the one on the JIRA and is still functionally the same. As someone who tries to read svn commit messages (and all committers or would-be-committers should be doing this to some extent!) patches like this are a nightmare. Regards, -Mark. > > Thanks, > Aleksey. > > [1] https://issues.apache.org/jira/browse/HARMONY-5771 > > On Tue, Apr 22, 2008 at 12:09 PM, Tim Ellison wrote: > > Aleksey Shipilev wrote: > > > > > Right, Tim. It was just the proof-of-concept "Does IdentityHashMap > > > tuning worth it?". > > > > > > > I think it is unhelpful to mix actual, concrete suggestions for performanc > e > > improvements, with proof-of-concept ideas that break the specification or > > security. > > > > Please can people mark clearly in their mail whether they are suggesting > > the idea only as "a thought experiment", otherwise somebody may apply the > > change without properly understanding the consequences. > > > > I realize the onus is on the committer to ensure it is safe but hiding suc > h > > problems is, as I said, unhelpful. > > > > Thanks, > > Tim > > > > > > > > > > > > > On Mon, Apr 21, 2008 at 4:50 PM, Tim Ellison > > wrote: > > > > > > > Sergey Salishev wrote: > > > > > > > > > > > > > It also should be noticed that replacing the IdentityHashMap with > > HashMap > > > > > > > > > in > > > > > > > > > Thread impl gives 4.5x boost on ThreadLocalBench. > > > > > > > > > > > > > > But it would be wrong since it opens a security vulnerability. > > > > > > > > See: > > > > http://markmail.org/message/rwq3kif5n33wp65m > > > > http://svn.apache.org/viewvc?view=rev&revision=477355 > > > > > > > > > > > > Regards, > > > > Tim > > > > > > > > > > > > > > > > >