Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Roedy Green Newsgroups: comp.lang.java.programmer Subject: Re: Bulk Array Element Allocation, is it faster? Date: Sat, 24 Sep 2011 19:05:15 -0700 Organization: Canadian Mind Products Lines: 40 Message-ID: References: Reply-To: Roedy Green NNTP-Posting-Host: RCd/Ul4tyxGUBII8WGwa5g.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Forte Agent 6.00/32.1186 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8278 On Sun, 25 Sep 2011 03:17:19 +0200, Jan Burse wrote, quoted or indirectly quoted someone who said : >Any clues new does two things: 1. allocates X bytes of space 2. initialises that block of space to a pattern. A clever jit may notice that some objects are simple, and always generate the exact same pattern. It can then replace the constructor code with a block move. A clever jit may notice that some objects are simple, except for a few computed bytes. It might be able to compose a fast constructor that does a block move then call the methods to compute the few computed bytes. Moving 0 to a group of bytes is even faster than a block move, since the source is a register or the instruction itself. So another idea is the jit could reorder the fields so that the ones needing the same initialisation byte pattern live side by side, so you can do it with a REP constant move. The flat footed way to do a constructor is to zap the entire block to 0, then go field by field initialised to non-null not-0 and plop that value in on top. Because constructors are called so often, even a very minor optimisation would pay off. -- Roedy Green Canadian Mind Products http://mindprod.com It should not be considered an error when the user starts something already started or stops something already stopped. This applies to browsers, services, editors... It is inexcusable to punish the user by requiring some elaborate sequence to atone, e.g. open the task editor, find and kill some processes.