Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Jan Burse Newsgroups: comp.lang.java.programmer Subject: Re: setSize ArrayList, when will it come? Date: Thu, 11 Aug 2011 01:52:28 +0200 Organization: albasani.net Lines: 25 Message-ID: References: <9aetckFmvmU1@mid.individual.net> <9aftbqFa9kU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net HmTZHeO4p1T726matInGlALbFXTb86+9AoUBb/e3eyoWLUjTIRip/70mb01j5d61MupdvayNBECIlUYPxYo2nA== NNTP-Posting-Date: Wed, 10 Aug 2011 23:52:31 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="Z2YHyKBpKyQyjnvxE9S/pov34J74zah5AGRYbrLJH+zxEizdX8onqXSF0E8IPU6CPKCYTSdoTFOOyx8CDeVtRBnIz/O5xjyyX4R2V3EcL1iZyDtT+AZLviclIpuAvO82"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110706 Firefox/5.0 SeaMonkey/2.2 In-Reply-To: Cancel-Lock: sha1:8pHG385viMypqCaGB9vjgAkfERs= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6999 Joshua Cranmer schrieb: > On 8/10/2011 1:37 PM, Jan Burse wrote: >> Look see: Migrating from Vector to ArrayList is all >> about energy saving. ArrayList does not use synchronized, >> therefore it does use less CPU. But in my case the >> migration is not perfect, since setSize() is missing. > > We have given *several* ways to re-emulate setSize using ArrayList. > Since moving from Vector to ArrayList causes savings in loss of > synchronized, perhaps the speed slowdown in your emulations is more than > made up for. > If the emulation eats up the speed gain of the remove the synchronization, then there is no use in doing the migration at all. The synchronization primitive in Java is already highly optimized, it has a fastpath in the non-competitive case. Removing synchronization gives some performance gain, but it is in the range of 5-20% only nowadays. It depends of course on how much synchronization the original application used. So the chances are very high, that an emulation eats up exactly these 5-20% percents. Bye