Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 48115 invoked from network); 2 Nov 2010 17:54:17 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 2 Nov 2010 17:54:17 -0000 Received: (qmail 86175 invoked by uid 500); 2 Nov 2010 17:54:47 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 86091 invoked by uid 500); 2 Nov 2010 17:54:47 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 86083 invoked by uid 99); 2 Nov 2010 17:54:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Nov 2010 17:54:47 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of brian@pontarelli.com designates 74.125.83.171 as permitted sender) Received: from [74.125.83.171] (HELO mail-pv0-f171.google.com) (74.125.83.171) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Nov 2010 17:54:41 +0000 Received: by pvg11 with SMTP id 11so938842pvg.30 for ; Tue, 02 Nov 2010 10:54:21 -0700 (PDT) Received: by 10.142.126.20 with SMTP id y20mr6080697wfc.150.1288720461224; Tue, 02 Nov 2010 10:54:21 -0700 (PDT) Received: from [10.1.10.46] (c-76-120-42-168.hsd1.co.comcast.net [76.120.42.168]) by mx.google.com with ESMTPS id p8sm11391640wff.16.2010.11.02.10.54.19 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 02 Nov 2010 10:54:20 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1081) Subject: Re: [Primitives] Does anyone use this? From: Brian Pontarelli In-Reply-To: Date: Tue, 2 Nov 2010 11:54:17 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: References: <579458222.337866.1288639948939.JavaMail.root@sz0116a.westchester.pa.mail.comcast.net> <4CCFF710.3080207@ll.mit.edu> <20101102172018.C5D46FDF@athena.apache.org> , To: "Commons Users List" X-Mailer: Apple Mail (2.1081) The autoboxing process mostly. When ints are autoboxed and unboxed, = there is a performance hit because it does method invocations and = instantiation. Autoboxing for some values will hit a cache to reduce = instantiation overhead, but I think that is only for numbers < 256.=20 I've found that Lists, Maps and Sets that work directly on primitives = reduce overhead quite a bit by removing the instantiation for the = autoboxing and the method invocation for unboxing. Of course, it all depends on the size and volume of access. I have a = Trie that used a Map internally and I switched it to a = primitive char map and it increased performance by about 20-30% and = reduced memory consumption as well. -bp On Nov 2, 2010, at 11:41 AM, Martin Gainty wrote: >=20 > Brian >=20 > how does primitive collections implementation perform better than JDK = collections? >=20 > thanks, > Martin=20 > ______________________________________________=20 > please do not alter or disrupt this transmission. thank you >=20 >=20 >=20 >=20 >=20 >> Subject: Re: [Primitives] Does anyone use this? >> From: brian@pontarelli.com >> Date: Tue, 2 Nov 2010 11:32:01 -0600 >> To: user@commons.apache.org >>=20 >> I would assume once you get out of the autoboxing caches the = performance will get even worse. It really depends on the application, = but I've found a number of spots where primitive collections work much = better than autoboxing and JDK collections. >>=20 >> -bp >>=20 >>=20 >> On Nov 2, 2010, at 11:25 AM, James Carman wrote: >>=20 >>> Yet another dependency to add to the mix. >>>=20 >>> On Tue, Nov 2, 2010 at 1:17 PM, Cogen, David - 1008 - MITLL >>> wrote: >>>>=20 >>>> ________________________________________ >>>> From: jcarman@carmanconsulting.com [jcarman@carmanconsulting.com] = On Behalf Of James Carman [james@carmanconsulting.com] >>>> Sent: Tuesday, November 02, 2010 12:30 PM >>>> To: Commons Users List >>>> Subject: Re: [Primitives] Does anyone use this? >>>>=20 >>>> Premature optimization with JDK5. I'd say stick to the JDK classes = if >>>> you can and only try to beef up space/performance if you need to. >>>>=20 >>>>=20 >>>> Normally I agree about evils of premature optimization. But = ArrayListInt is practically a drop-in replacement for ArrayList = and I see no reason not to use it if it is supported and reliable. >>>>=20 >>>> My test of 2 billion accesses (reads and writes) ran in 35% of the = time when I used ArrayListInt vs. ArrayList. >>>> = --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org >>>> For additional commands, e-mail: user-help@commons.apache.org >>>>=20 >>>>=20 >>>=20 >>> = --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org >>> For additional commands, e-mail: user-help@commons.apache.org >>>=20 >>=20 >>=20 >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org >> For additional commands, e-mail: user-help@commons.apache.org >>=20 > =20 --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org