Comparison of assignment efficiency of Java array

Source: Internet
Author: User

1.for cycle-by-copy
2.system.arraycopy

3.array.copyof
4. Using the Clone method
Efficiency comparison of the above four methods:

  system.arraycopy > Clone > System.copyof > for loop

Note: Arraycopy as the Natvie (local) method, is the fastest, the following method of the source code description.
Arrays.copyof (Arrays Class) implementation, in the source code is called system.copyof, a step more.
The source code for clone is defined as follows;
Protected native Object clone () throws Clonenotsupportedexception;
Many of the posts on the clone web show the results of the experiment.
The post may be more detailed:
http://xuyuanshuaaa.iteye.com/blog/1046621
http://blog.csdn.net/stand1210/article/details/52686740 (Efficiency Experiment)
http://blog.csdn.net/tingzhiyi/article/details/52344845




Comparison of assignment efficiency of Java array

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.