[mlpack] [mlpack/mlpack] using rvalue references to set a given reference tree in FastMKS and DualTreeBoruvka (#799)

Ryan Curtin notifications at github.com
Tue Dec 20 16:17:27 EST 2016


rcurtin commented on this pull request.



> @@ -34,8 +34,7 @@ void BuildFastMKSModel(FastMKS<KernelType>& f,
     // Create the tree with the specified base.
     Timer::Start("tree_building");
     metric::IPMetric<KernelType> metric(k);
-    typename FastMKS<KernelType>::Tree* tree =
-        new typename FastMKS<KernelType>::Tree(referenceData, metric, base);
+    typename FastMKS<KernelType>::Tree tree(referenceData, metric, base);
     Timer::Stop("tree_building");
 
     f.Train(tree);

We should use `std::move(tree)` here to avoid copying the entire tree---that will be a big speed improvement.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/799#pullrequestreview-13852662
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://knife.lugatgt.org/pipermail/mlpack/attachments/20161220/57c90f12/attachment-0001.html>


More information about the mlpack mailing list