<p>In <a href="https://github.com/mlpack/mlpack/pull/686#discussion_r69383465">src/mlpack/methods/ne/genome.hpp</a>:</p>
<pre style='color:#555'>&gt; +    std::vector&lt;double&gt; toNeuronDepths;
&gt; +    for (ssize_t i=0; i&lt;aLinkGenes.size(); ++i) {
&gt; +      NeuronGene toNeuron = GetNeuronById(aLinkGenes[i].ToNeuronId());
&gt; +      toNeuronDepths.push_back(toNeuron.Depth());
&gt; +    }
&gt; +
&gt; +    std::vector&lt;DepthAndLink&gt; depthAndLinks;
&gt; +    ssize_t linkGenesSize = aLinkGenes.size();
&gt; +    for (ssize_t i=0; i&lt;linkGenesSize; ++i) {
&gt; +      depthAndLinks.push_back(DepthAndLink(toNeuronDepths[i], aLinkGenes[i]));
&gt; +    }
&gt; +
&gt; +    std::sort(depthAndLinks.begin(), depthAndLinks.end());
&gt; +
&gt; +    for (ssize_t i=0; i&lt;linkGenesSize; ++i) {
&gt; +      aLinkGenes[i] = depthAndLinks[i].link;
</pre>
<p>I think, we could speed this up, if we would just store the index of all linkGenes, an use another list, that contains all linkGenes as a reference.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/mlpack/mlpack/pull/686/files/554a279b0089e4385dfb40077e578d6ae2a42ece#r69383465">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/AJ4bFDm5ulxXmfreJ6dpc4dDRIwMHpj9ks5qRuiFgaJpZM4IwJa6">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFPKHG832UOVfgMmcjOhG66lXNPlbks5qRuiFgaJpZM4IwJa6.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/mlpack/mlpack/pull/686/files/554a279b0089e4385dfb40077e578d6ae2a42ece#r69383465"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>