0% found this document useful (0 votes)
3 views1 page

Performance Comparison of Array Copy Methods

The document compares the speeds of three Java array processes: ArrayCopy.java, ArrayCopy2.java, and ArrayClone.java. It finds that ArrayClone.java is the fastest, taking 16385700 nanoseconds to complete, while ArrayCopy.java is the slowest at 18462500 nanoseconds. ArrayCopy2.java is faster than ArrayCopy.java because it has fewer repetitions copying array elements. ArrayClone.java is fastest because it returns a new array without needing to copy elements one by one like the other processes.

Uploaded by

Yyuyun Aisyah
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Performance Comparison of Array Copy Methods

The document compares the speeds of three Java array processes: ArrayCopy.java, ArrayCopy2.java, and ArrayClone.java. It finds that ArrayClone.java is the fastest, taking 16385700 nanoseconds to complete, while ArrayCopy.java is the slowest at 18462500 nanoseconds. ArrayCopy2.java is faster than ArrayCopy.java because it has fewer repetitions copying array elements. ArrayClone.java is fastest because it returns a new array without needing to copy elements one by one like the other processes.

Uploaded by

Yyuyun Aisyah
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Dwi Putri Wahyuningsih

Compare between [Link], [Link], and [Link]

Java Nanoseconds
[Link] 18462500
[Link] 16575300
[Link] 16385700

What is faster between the three processes is the [Link]. And the slowest among the
three processes is the [Link]. Because the first [Link] is a repetition that is
done one by one, the more repetitions that occur in an array process, the longer the array process
is run.

Why is [Link] faster than [Link]?

Because of that, earlier the [Link] happened three times while the [Link]
only happened twice. Even though the copy elements in the array are the same one by one.

And lastly why are [Link] faster than [Link] or [Link]?

Because in the [Link] the method used returns a new array object containing all the
elements in the original array. Whereas in the [Link] and [Link] the method
copies the elements into another existing array. Not only that in the [Link] also does
not need to use repetitions one by one on each element. Unlike [Link] and
[Link], which repeat one by one on each element of the array.

You might also like