Re: System.arrayCopy Vs array clone
- From: Lew <lew@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 27 Feb 2007 23:07:56 -0500
Daniel Pitts wrote:
On Feb 27, 12:52 pm, mei <m...@xxxxxx> wrote:Hello,
I read in bloch's effective java that the only interesting use of
clone() is to copy array cheaply. On the web, I found opposite opinions:
Some people pretend that instantiate a new array, then call
System.arrayCopy is faster.
I made a quick bench that seems to confirm this second hypothesis.
However, with all the respect I have for the author, I wished all the
same to ask the question on this newsgroup. Is there something I and a
few other people from the Internet missed?
Thanks in advance,
Mei.
Its probably an "out of date" assertion.
No, it remains interesting. Notice that Bloch doesn't say "recommended" use.
There have been a number of threads here touching on the dangers of assuming performance characteristics in a Java program, especially between versions.
Algorithmic characteristics of a benchmark and execution profiles from its testbed both influence the outcome.
Since you actually measured the performance you have some facts about System.arrayCopy(). Would you be willing to share your benchmark code and how you ran it?
- Lew
.
- Follow-Ups:
- Re: System.arrayCopy Vs array clone
- From: mei
- Re: System.arrayCopy Vs array clone
- References:
- System.arrayCopy Vs array clone
- From: mei
- Re: System.arrayCopy Vs array clone
- From: Daniel Pitts
- System.arrayCopy Vs array clone
- Prev by Date: Re: NewBee help with HashMaps - extra
- Next by Date: Re: struts html:form with javascript for ajax
- Previous by thread: Re: System.arrayCopy Vs array clone
- Next by thread: Re: System.arrayCopy Vs array clone
- Index(es):