<p>The current code allocates space equal to the reference set and then uses arma::find to identify non-zero indices which were returned as the candidate set. This results in large memory allocations and slows down candidate search.</p>

<p>My change loops over the hash tables twice, first counting the number of reference points in the same bucket as the query and then a second time to actually add candidates to the reference set. This provides a small performance bump which should get more significant for larger reference sets.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>&nbsp;&nbsp;<a href='https://github.com/mlpack/mlpack/pull/623'>https://github.com/mlpack/mlpack/pull/623</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>LSHSearch optimization to use less memory, first working copy</li>
  <li>LSHSearch Optimization: ReturnIndicesFromTable uses less memory</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/mlpack/mlpack/pull/623/files#diff-0">src/mlpack/methods/lsh/lsh_search_impl.hpp</a>
    (46)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/mlpack/mlpack/pull/623.patch'>https://github.com/mlpack/mlpack/pull/623.patch</a></li>
  <li><a href='https://github.com/mlpack/mlpack/pull/623.diff'>https://github.com/mlpack/mlpack/pull/623.diff</a></li>
</ul>

<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 or <a href="https://github.com/mlpack/mlpack/pull/623">view it on GitHub</a><img alt="" height="1" src="https://github.com/notifications/beacon/AJ4bFBTNOkO7YJJQo4KaLXQB06g3ePvMks5p4SmbgaJpZM4II_F4.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/623"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>