title: apply() is slow - how to make it faster or what are my alternatives?
body: <p>I have a quite large data frame, about 10 millions of rows. It has columns <code>x</code> and <code>y</code>, and what I want is to compute</p>
  
  <pre><code>hypot &lt;- function(x) {sqrt(x[1]^2 + x[2]^2)}
  </code></pre>
  
  <p>for each row. Using <code>apply</code> it would take a lot of time (about 5 minutes, interpolating from lower sizes) and memory.</p>
  
  <p>But it seems to be too much for me, so I've tried different things:</p>
  
  <ul>
  <li>compiling the <code>hypot</code> function reduces the time by about 10%</li>
  <li>using functions from <code>plyr</code> greatly increases the running time.</li>
  </ul>
  
  <p>What's the fastest way to do this thing?</p>