Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [january-dev] clone() vs System.arraycopy

A timely reminder, now that the 2.1 release is out I have requested
conversion to JIPP:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=526133
~~~
Jonah Graham
Kichwa Coders Ltd.
www.kichwacoders.com


On 17 October 2017 at 11:53,  <Peter.Chang@xxxxxxxxxxxxx> wrote:
>
>
> Well, once we move to a JIPP then we can integrate the micro benchmarking
> and end these “optimisations” ;-) Well, at least for one JVM.
>
>
>
> Peter
>
>
>
>
>
>
>
> From: january-dev-bounces@xxxxxxxxxxx
> [mailto:january-dev-bounces@xxxxxxxxxxx] On Behalf Of Matthew Gerring
> Sent: 17 October 2017 11:49
> To: Filik, Jacob (DLSLtd,RAL,LSCI) <Jacob.Filik@xxxxxxxxxxxxx>
> Cc: january developer discussions <january-dev@xxxxxxxxxxx>
> Subject: Re: [january-dev] clone() vs System.arraycopy
>
>
>
> Thanks for reading that. He also says:
>
>
>
> "Oops, it seems that once the array becomes longer, the performance of the
> two is almost equal! Infact, the cloning seems marginally faster. Aren't you
> glad that you have not changed all your code yet?"
>
>
>
> :)
>
>
>
> On 17 October 2017 at 11:45, <Jacob.Filik@xxxxxxxxxxxxx> wrote:
>
> I have only skimmed the article but he concludes:
>
>
>
> This leads me to conclude that the only reason why Paul's test seemed so
> much faster was because he picked a byte[] size that was small enough that
> the actual copying was dwarfed by the two if statements. Using clone() for
> copying arrays is less code and the performance difference is, as we saw,
> only significant for tiny arrays. I think that in future I will rather use
> clone() than System.arrayCopy().
>
>
>
>
>
>
>
> From: january-dev-bounces@xxxxxxxxxxx
> [mailto:january-dev-bounces@xxxxxxxxxxx] On Behalf Of Matthew Gerring
> Sent: 17 October 2017 11:35
> To: january developer discussions <january-dev@xxxxxxxxxxx>
> Subject: [january-dev] clone() vs System.arraycopy
>
>
>
> Hello,
>
>
>
> January uses clone() quite a bit when duplicating large primitive arrays.
> For one of many instances see FloatDataset:
>
> odata = data = dataset.data.clone()
>
>
>
> However System.arraycopy is ~5x faster according to:
>
> http://www.javaspecialists.co.za/archive/Issue124.html
>
>
>
> Are there any plans to migrate from clone to arraycopy? Or do I have to
> submit a PR to do that? I might ask one of the team here to submit that
> change if you agree, please let me know you thoughts.
>
>
>
> Matt
>
>
>
> --
>
> This e-mail and any attachments may contain confidential, copyright and or
> privileged material, and are for the use of the intended addressee only. If
> you are not the intended addressee or an authorised recipient of the
> addressee please notify us of receipt by returning the e-mail and do not
> use, copy, retain, distribute or disclose the information in or attached to
> the e-mail.
> Any opinions expressed within this e-mail are those of the individual and
> not necessarily of Diamond Light Source Ltd.
> Diamond Light Source Ltd. cannot guarantee that this e-mail or any
> attachments are free from viruses and we cannot accept liability for any
> damage which you may sustain as a result of software viruses which may be
> transmitted in or with the message.
> Diamond Light Source Limited (company no. 4375679). Registered in England
> and Wales with its registered office at Diamond House, Harwell Science and
> Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
>
>
>
>
>
>
> --
>
> This e-mail and any attachments may contain confidential, copyright and or
> privileged material, and are for the use of the intended addressee only. If
> you are not the intended addressee or an authorised recipient of the
> addressee please notify us of receipt by returning the e-mail and do not
> use, copy, retain, distribute or disclose the information in or attached to
> the e-mail.
> Any opinions expressed within this e-mail are those of the individual and
> not necessarily of Diamond Light Source Ltd.
> Diamond Light Source Ltd. cannot guarantee that this e-mail or any
> attachments are free from viruses and we cannot accept liability for any
> damage which you may sustain as a result of software viruses which may be
> transmitted in or with the message.
> Diamond Light Source Limited (company no. 4375679). Registered in England
> and Wales with its registered office at Diamond House, Harwell Science and
> Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
>
>
>
> _______________________________________________
> january-dev mailing list
> january-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/january-dev
>


Back to the top