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: Bulk Array Element Allocation, is it faster? Date: Sun, 25 Sep 2011 16:11:29 +0200 Organization: albasani.net Lines: 39 Message-ID: References: <9e8fplF19bU1@mid.individual.net> <9e8kdhF6lmU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net TORwNH7l2u/sJoRmTEuJjXtPceAsG4/1zmy4ZXUPJ/Q98S7JPVyt4THq0wVD9BO+jSP8if2IyyELjCRpvkrezQ== NNTP-Posting-Date: Sun, 25 Sep 2011 14:11:30 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="/TkjkQIgldwsTRo7STMmFWomQh8hnYd/0TK3/VEmVF5GDuVaiGeccbNBoyt+zv2QOgu2pXksh1rXntKRZEjQ1v0pV/8r0rINA0kNMW1sq0U20KE9GeyWi/4lmCZmXynh"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:6.0.2) Gecko/20110902 Firefox/6.0.2 SeaMonkey/2.3.3 In-Reply-To: Cancel-Lock: sha1:Rhjt+/0Afb1780jlqrfInnkaPyg= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8294 Jan Burse schrieb: > Currently I am planning to change the loop > to something like that: > > Bla[] bla = new Bla[n]; > for (int i=0; i bla[i] = createBla(); > } > > So that the JIT has less information on what > the loop is about, and to do some new > measurements. To be fair I would also use > createBla() in the lazy scenario. Lets see > what happens. Maybe there is a bug somewhere else in the application that leads to the performance loss. There are also points in the application where some of the bla elements are forcefully set to null so as to release Bla objects: ... bla[j] = null; ... I am not sure whether these releases work the same in the bulk and the lazy version of the code. Need to check first. So measurements have already shown that the release gives some gain, measurements where 16000 ms vs. 9600 ms. The release condition is more complicated than the lazy new condition, but the overhead is compensated the overall gain. Lets see. Best Regards