# vtkDataObject::ThreadedDeepCopy() ?

**URL:** https://discourse.vtk.org/t/vtkdataobject-threadeddeepcopy/3537
**Category:** Development
**Created:** [June 12, 2020, 6:29pm UTC](https://discourse.vtk.org/t/vtkdataobject-threadeddeepcopy/3537 "2020-06-12T18:29:57Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Dave\_DeMarle](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dave_demarle/32/6_2.png) [@Dave\_DeMarle](https://discourse.vtk.org/u/Dave_DeMarle)
#### Post date: [June 12, 2020, 6:29pm UTC](https://discourse.vtk.org/t/vtkdataobject-threadeddeepcopy/3537/1 "2020-06-12T18:29:57Z")

</div>

Greetings,

Does there exist such a thing as a threaded version of vtkDataObject::DeepCopy()?

It turns out that the DeepCopy that happens inside of vtkTemporalDataSetCache when using extended memory is quite a bottleneck. We should be able to make better use of available memory bandwidth if we did not do the copy of at least large arrays sequentially.

I’ve done a minimum amount of snooping around inside of vtkSMPTools and in @AllisonVacanti’s c++11 modernization posts and I can see how it might be done, but as always I was hoping that someone else had already done it.

thanks for your ideas.

---

<div class="post-metadata">

### Author: ![Dave\_DeMarle](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dave_demarle/32/6_2.png) [@Dave\_DeMarle](https://discourse.vtk.org/u/Dave_DeMarle)
#### Post date: [July 9, 2020, 1:57pm UTC](https://discourse.vtk.org/t/vtkdataobject-threadeddeepcopy/3537/2 "2020-07-09T13:57:35Z")

</div>

I think that all that will be required is to thread the deepcopy of vtkDataArray. I started on that [here](https://gitlab.kitware.com/demarle/vtk/-/commit/40c0b74178d2f19611837c0f0fd35860415253a7). The results from the test case in the commit are very promising - the imagedata copy goes from 9.5 sec down to 1.8 on my machine.

---

<div class="post-metadata">

### Author: ![Dave\_DeMarle](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dave_demarle/32/6_2.png) [@Dave\_DeMarle](https://discourse.vtk.org/u/Dave_DeMarle)
#### Post date: [September 16, 2020, 12:49pm UTC](https://discourse.vtk.org/t/vtkdataobject-threadeddeepcopy/3537/3 "2020-09-16T12:49:02Z")

</div>

Implementation of the important thing - threaded array deepcopies - was merged here: [https://gitlab.kitware.com/vtk/vtk/-/merge\_requests/7252](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/7252)
