Re: System.arrayCopy Vs array clone



mei wrote:
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?

It probably depend on Java vendor, platform and version.

Meaning that there are a few hundred possible results.

There are absolutely no guarantee that IBM Java 1.3.1 on AIX PPC
will have same characteristics as SUN Java 1.5.0 on Win32 x86.

That said then my expectation will be that:
- the difference is small because they basically do the same thing
- extremely few real world applications will be effected by the
difference

Arne
.