Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 43029 invoked from network); 3 Jun 2003 19:52:51 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 3 Jun 2003 19:52:51 -0000 Received: (qmail 10298 invoked by uid 97); 3 Jun 2003 19:55:08 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@nagoya.betaversion.org Received: (qmail 10291 invoked from network); 3 Jun 2003 19:55:08 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 3 Jun 2003 19:55:08 -0000 Received: (qmail 42813 invoked by uid 500); 3 Jun 2003 19:52:49 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 42802 invoked from network); 3 Jun 2003 19:52:49 -0000 Received: from unknown (HELO mustang.mpi.com) (63.244.250.132) by daedalus.apache.org with SMTP; 3 Jun 2003 19:52:49 -0000 Received: from thunderbolt.mpi.com (thunderbolt.mpi.com [199.93.192.55]) by mustang.mpi.com (Switch-2.2.6/Switch-2.2.6) with ESMTP id h53Jqoh03128 for ; Tue, 3 Jun 2003 15:52:50 -0400 (EDT) Received: from US-VS1.corp.mpi.com (us-be2.corp.mpi.com [199.93.195.21]) by thunderbolt.mpi.com (Switch-3.0.4/Switch-3.0.0) with ESMTP id h53JqbfZ005948 for ; Tue, 3 Jun 2003 15:52:52 -0400 (EDT) X-MimeOLE: Produced By Microsoft Exchange V6.0.6375.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [COLLECTIONS] FastHashMap performance Date: Tue, 3 Jun 2003 15:52:47 -0400 Message-ID: <9C5166762F311146951505C6790A9CF8A6E5E2@US-VS1.corp.mpi.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [COLLECTIONS] FastHashMap performance Thread-Index: AcMqB4KzCFY0mc1lQ0SVJiDtKK1iDgAAbjFw From: "Shapira, Yoav" To: "Jakarta Commons Developers List" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Howdy, Assuming I agree that GC and JIT play a role in my benchmark (which I don't without further convincing), how should I disable them? I see -XX:-DisableExplicitGC is a VM option, but it only disables explicit System.gc() calls, which I don't use anyways. I couldn't fin= d an option to disable JIT. The heap has ample space to hold the objects in my benchmark. My results don't change if I increase -Xmx or change -Xms to match -Xmx. Yoav Shapira Millennium ChemInformatics >-----Original Message----- >From: Juozas Baliuka [mailto:baliuka@centras.lt] >Sent: Tuesday, June 03, 2003 3:37 PM >To: Jakarta Commons Developers List >Subject: Re: [COLLECTIONS] FastHashMap performance > > >I have tried to implement performance tests for maps, but it is not >trivial. >Try to dissable GC and JIT for performance tests. > >----- Original Message ----- >From: "Shapira, Yoav" >To: "Jakarta Commons Developers List" >Sent: Tuesday, June 03, 2003 9:05 PM >Subject: RE: [COLLECTIONS] FastHashMap performance > > > >Howdy, >I've had tests with both a normal hashmap (just new HashMap() used) a= nd >a synchronized wrapper (Collections.synchronizedMap(new HashMap()). = I >would expect the normal HashMap to be faster than both the FastHashMa= p >and the synchronized HashMap. Is my expectation wrong? > >However, here are the results: >[MapTest: FastHashMap: false / Synchronized wrapper: false / Insert >time: 1592 / Read time: 30] >[MapTest: FastHashMap: true / Synchronized wrapper: false / Insert time: >1265 / Read time: 6] >[MapTest: FastHashMap: false / Synchronized wrapper: true / Insert time: >983 / Read time: 7] >[MapTest: FastHashMap: false / Synchronized wrapper: false / Insert >time: 1158 / Read time: 2] >[MapTest: FastHashMap: true / Synchronized wrapper: false / Insert time: >1194 / Read time: 2] >[MapTest: FastHashMap: false / Synchronized wrapper: true / Insert time: >827 / Read time: 2] >[MapTest: FastHashMap: false / Synchronized wrapper: false / Insert >time: 990 / Read time: 2] >[MapTest: FastHashMap: true / Synchronized wrapper: false / Insert time: >1006 / Read time: 2] >[MapTest: FastHashMap: false / Synchronized wrapper: true / Insert time: >732 / Read time: 2] >[MapTest: FastHashMap: false / Synchronized wrapper: false / Insert >time: 949 / Read time: 3] >[MapTest: FastHashMap: true / Synchronized wrapper: false / Insert time: >1003 / Read time: 2] >[MapTest: FastHashMap: false / Synchronized wrapper: true / Insert time: >1579 / Read time: 2] >[MapTest: FastHashMap: false / Synchronized wrapper: false / Insert >time: 888 / Read time: 2] >[MapTest: FastHashMap: true / Synchronized wrapper: false / Insert time: >1045 / Read time: 2] >[MapTest: FastHashMap: false / Synchronized wrapper: true / Insert time: >793 / Read time: 2] >[MapTest: FastHashMap: false / Synchronized wrapper: false / Insert >time: 1151 / Read time: 2] >[MapTest: FastHashMap: true / Synchronized wrapper: false / Insert time: >855 / Read time: 2] >[MapTest: FastHashMap: false / Synchronized wrapper: true / Insert time: >905 / Read time: 3] >[MapTest: FastHashMap: false / Synchronized wrapper: false / Insert >time: 1217 / Read time: 1] >[MapTest: FastHashMap: true / Synchronized wrapper: false / Insert time: >1269 / Read time: 2] >[MapTest: FastHashMap: false / Synchronized wrapper: true / Insert time: >1107 / Read time: 2] >[MapTest: FastHashMap: false / Synchronized wrapper: false / Insert >time: 1062 / Read time: 2] >[MapTest: FastHashMap: true / Synchronized wrapper: false / Insert time: >1252 / Read time: 2] >[MapTest: FastHashMap: false / Synchronized wrapper: true / Insert time: >971 / Read time: 2] >[MapTest: FastHashMap: false / Synchronized wrapper: false / Insert >time: 1460 / Read time: 2] >[MapTest: FastHashMap: true / Synchronized wrapper: false / Insert time: >1404 / Read time: 2] >[MapTest: FastHashMap: false / Synchronized wrapper: true / Insert time: >1110 / Read time: 2] >[MapTest: FastHashMap: false / Synchronized wrapper: false / Insert >time: 1278 / Read time: 2] >[MapTest: FastHashMap: true / Synchronized wrapper: false / Insert time: >1193 / Read time: 2] >[MapTest: FastHashMap: false / Synchronized wrapper: true / Insert time: >1096 / Read time: 2] > >Yoav Shapira >Millennium ChemInformatics > > >>-----Original Message----- >>From: ericpabst@discoverfinancial.com >>[mailto:ericpabst@discoverfinancial.com] >>Sent: Tuesday, June 03, 2003 2:58 PM >>To: Jakarta Commons Developers List >>Subject: RE: [COLLECTIONS] FastHashMap performance >> >> >>In your test, are you synchronizing the HashMap? FastHashMap >implements >>smart synchronization. It should not be compared with an >unsynchronized >>version of HashMap. >> >>P.S. In fact, it might be nice to allow doing this smart >synchronization >>on *any* Map. i.e. alternative to Collections.synchronizeMap(Map). >> >>Eric Pabst >>Discover Financial Services >>2500 Lake Park Blvd., 3N >>West Valley City, UT 84120 >>Ph: 801.902.4636 >>Fax: 801.902.4123 >> >> >> >>|---------+---------------------------> >>| | "Shapira, Yoav" | >>| | >| | i.com> | >>| | | >>| | 06/03/03 12:54 | >>| | PM | >>| | Please respond | >>| | to "Jakarta | >>| | Commons | >>| | Developers List"| >>| | | >>|---------+---------------------------> >> >>--------------------------------------------------------------------= -- - >- >>---------------------------------------| >> | >>| >> | To: "Jakarta Commons Developers List" >dev@jakarta.apache.org> | >> | cc: >>| >> | Subject: RE: [COLLECTIONS] FastHashMap performance >>| >> >>--------------------------------------------------------------------= -- - >- >>---------------------------------------| >> >> >> >> >> >>Howdy, >>I understand it's just a wrapper, and that the >>reading cannot be any faster. I'm curious why the >>writing is so much faster, even in the default (not fast) >>mode of FastHashMap. >> >>Yoav Shapira >>Millennium ChemInformatics >> >> >>>-----Original Message----- >>>From: Juozas Baliuka [mailto:baliuka@centras.lt] >>>Sent: Tuesday, June 03, 2003 2:36 PM >>>To: Jakarta Commons Developers List >>>Subject: Re: [COLLECTIONS] FastHashMap performance >>> >>>FastHashMap can not be faster than HasMap in single thread just >because >>it >>>uses HasMap to implement mappings: >>> >>> public Object get(Object key) { >>> if (fast) { >>> return (map.get(key)); >>> } else { >>> synchronized (map) { >>> return (map.get(key)); >>> } >>> } >>> } >>> >>> >>>/** >>> * Construct an empty map. >>> */ >>> public FastHashMap() { >>> super(); >>> this.map =3D new HashMap(); >>> } >>> >>>----- Original Message ----- >>>From: "Shapira, Yoav" >>>To: "Jakarta Commons Developers List" >>>Sent: Tuesday, June 03, 2003 8:00 PM >>>Subject: RE: [COLLECTIONS] FastHashMap performance >>> >>> >>>Howdy, >>>Neither did I, but I just ran the attached benchmark and got >surprising >>>results. I hope the attachement comes through OK: if not I'll re-post >>>inline. This benchmark has just one thread writing, one thread >>reading, >>>which I expected to be the case where FastHashMap is not as efficie= nt >>as >>>HashMap. >>> >>>The benchmark inserts 100000 records in the map, then reads 1000 of= >>>those at random. I run this 10 times for each map implemention. I= 'm >>>ignoring the first run read times as there's overhead in initializi= ng >>>the Random generator. >>> >>>I'm running this test on JDK 1.4.1, no special java switches, just >java >>>MapTest on the command line, on Solaris 8. >>> >>>I'm very curious to hear comments, ideas. I was expecting to have = to >>>write another test with multiple writing threads, but if FastHashMa= p >is >>>faster even for the simple case, why ever use the regular HashMap? >>> >>>The results are: >>>[MapTest: Map class: java.util.HashMap / Insert time: 1616 / Read >time: >>>30] >>>[MapTest: Map class: org.apache.commons.collections.FastHashMap / >>Insert >>>time: 1252 / Read time: 6] >>>[MapTest: Map class: java.util.HashMap / Insert time: 958 / Read time: >>>2] >>>[MapTest: Map class: org.apache.commons.collections.FastHashMap / >>Insert >>>time: 1203 / Read time: 2] >>>[MapTest: Map class: java.util.HashMap / Insert time: 820 / Read time: >>>2] >>>[MapTest: Map class: org.apache.commons.collections.FastHashMap / >>Insert >>>time: 988 / Read time: 2] >>>[MapTest: Map class: java.util.HashMap / Insert time: 781 / Read time: >>>2] >>>[MapTest: Map class: org.apache.commons.collections.FastHashMap / >>Insert >>>time: 1033 / Read time: 3] >>>[MapTest: Map class: java.util.HashMap / Insert time: 720 / Read time: >>>2] >>>[MapTest: Map class: org.apache.commons.collections.FastHashMap / >>Insert >>>time: 1067 / Read time: 2] >>>[MapTest: Map class: java.util.HashMap / Insert time: 1454 / Read >time: >>>2] >>>[MapTest: Map class: org.apache.commons.collections.FastHashMap / >>Insert >>>time: 1267 / Read time: 2] >>>[MapTest: Map class: java.util.HashMap / Insert time: 1534 / Read >time: >>>2] >>>[MapTest: Map class: org.apache.commons.collections.FastHashMap / >>Insert >>>time: 862 / Read time: 2] >>>[MapTest: Map class: java.util.HashMap / Insert time: 1433 / Read >time: >>>2] >>>[MapTest: Map class: org.apache.commons.collections.FastHashMap / >>Insert >>>time: 844 / Read time: 2] >>>[MapTest: Map class: java.util.HashMap / Insert time: 1578 / Read >time: >>>2] >>>[MapTest: Map class: org.apache.commons.collections.FastHashMap / >>Insert >>>time: 1488 / Read time: 2] >>>[MapTest: Map class: java.util.HashMap / Insert time: 1450 / Read >time: >>>2] >>>[MapTest: Map class: org.apache.commons.collections.FastHashMap / >>Insert >>>time: 859 / Read time: 2] >>> >>>Yoav Shapira >>>Millennium ChemInformatics >>> >>> >>>>-----Original Message----- >>>>From: Juozas Baliuka [mailto:baliuka@centras.lt] >>>>Sent: Tuesday, June 03, 2003 1:53 PM >>>>To: Jakarta Commons Developers List >>>>Subject: Re: [COLLECTIONS] FastHashMap performance >>>> >>>>I do not think it is faster than java.util.HashMap, it is just pseudo >>>>thread >>>>safe wrapper. >>>> >>>>----- Original Message ----- >>>>From: "Shapira, Yoav" >>>>To: >>>>Sent: Tuesday, June 03, 2003 7:17 PM >>>>Subject: [COLLECTIONS] FastHashMap performance >>>> >>>> >>>> >>>>Howdy, >>>>Has anyone benchmarked the performance of the FastHashMap and how = it >>>>compares to the java.util.HashMap implementation? If so, are the >>>>benchmarks available online somewhere? >>>> >>>>I don't doubt its quality nor its performance, just curious... >Thanks, >>>> >>>>Yoav Shapira >>>>Millennium ChemInformatics >>>> >>>> >>>> >>>> >>>> >>>>This e-mail, including any attachments, is a confidential business= >>>>communication, and may contain information that is confidential, >>>>proprietary >>>>and/or privileged. This e-mail is intended only for the >individual(s) >>>to >>>>whom it is addressed, and may not be saved, copied, printed, >disclosed >>>or >>>>used by anyone else. If you are not the(an) intended recipient, >>please >>>>immediately delete this e-mail from your computer system and notif= y >>the >>>>sender. Thank you. >>>> >>>> >>>>------------------------------------------------------------------= -- - >>>>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org= >>>>For additional commands, e-mail: commons-dev-help@jakarta.apache.o= rg >>>> >>>> >>>> >>>>------------------------------------------------------------------= -- - >>>>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org= >>>>For additional commands, e-mail: commons-dev-help@jakarta.apache.o= rg >>> >>> >>> >>> >>>This e-mail, including any attachments, is a confidential business >>>communication, and may contain information that is confidential, >>>proprietary >>>and/or privileged. This e-mail is intended only for the individual(s) >>to >>>whom it is addressed, and may not be saved, copied, printed, disclosed >>or >>>used by anyone else. If you are not the(an) intended recipient, >please >>>immediately delete this e-mail from your computer system and notify= >the >>>sender. Thank you. >>> >>> >>> >>> >>> >>>-------------------------------------------------------------------= -- - >- >>---- >>>- >>>---- >>> >>> >>>> >---------------------------------------------------------------------= >>>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.or= g >>>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org >>> >>> >>>-------------------------------------------------------------------= -- >>>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org >>>For additional commands, e-mail: commons-dev-help@jakarta.apache.or= g >> >> >> >> >>This e-mail, including any attachments, is a confidential business >>communication, and may contain information that is confidential, >>proprietary and/or privileged. This e-mail is intended only for the= >>individual(s) to whom it is addressed, and may not be saved, copied,= >>printed, disclosed or used by anyone else. If you are not the(an) >intended >>recipient, please immediately delete this e-mail from your computer >system >>and notify the sender. Thank you. >> >> >>--------------------------------------------------------------------= - >>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org >>For additional commands, e-mail: commons-dev-help@jakarta.apache.org= >> >> >> >> >> >> >> >>--------------------------------------------------------------------= - >>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org >>For additional commands, e-mail: commons-dev-help@jakarta.apache.org= > > > > >This e-mail, including any attachments, is a confidential business >communication, and may contain information that is confidential, >proprietary >and/or privileged. This e-mail is intended only for the individual(s= ) to >whom it is addressed, and may not be saved, copied, printed, disclose= d or >used by anyone else. If you are not the(an) intended recipient, plea= se >immediately delete this e-mail from your computer system and notify t= he >sender. Thank you. > > >---------------------------------------------------------------------= >To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org >For additional commands, e-mail: commons-dev-help@jakarta.apache.org > > > >---------------------------------------------------------------------= >To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org >For additional commands, e-mail: commons-dev-help@jakarta.apache.org This e-mail, including any attachments, is a confidential business com= munication, and may contain information that is confidential, propriet= ary and/or privileged. This e-mail is intended only for the individua= l(s) to whom it is addressed, and may not be saved, copied, printed, d= isclosed or used by anyone else. If you are not the(an) intended reci= pient, please immediately delete this e-mail from your computer system= and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org