Why is System.arraycopy native in Java?

Posted by James B on Stack Overflow See other posts from Stack Overflow or by James B
Published on 2010-05-05T10:01:45Z Indexed on 2010/05/05 10:08 UTC
Read the original article Hit count: 271

Filed under:
|
|
|
|

I was surprised to see in the Java source that System.arraycopy is a native method.

Of course the reason is because it's faster. But what native tricks is the code able to employ that make it faster?

Why not just loop over the original array and copy each pointer to the new array - surely this isn't that slow and cumbersome?

Thanks,

-James

© Stack Overflow or respective owner

Related posts about java

Related posts about arraycopy