Best apply function for a large data set which takes multiple arguments
<p>I got a big data set.</p>

<p>When I used mapply, I got this time for running the code for one instance(I have 400 thousand instances)</p>

<p><code>user  system elapsed 
 0.49    0.05    0.53</code>
function takes 2 arguments as input.</p>

<p>Got the idea from <a href="https://stackoverflow.com/questions/10078211/use-multiple-columns-as-variables-with-sapply">this</a> link</p>

<p>Is there any apply function ideas for efficiently running the code?</p>

<p>Edit: To give a good idea of code</p>

<pre><code>`A$V1&lt;- sample(50000)
 A$V2&lt;- sample(50000)
output&lt;-mapply(myfun, A$V1, A$V2)

myfun&lt;- function(x,y)
return(length(which(x&lt;=gh2$data_start &amp; y&gt;=gh2$data_end)))`
</code></pre>

<p>gh2 is a data frame with 1 billion rows.
which function itself consumes 0.30 sec for one search along this big gh2 data frame.
Intention is to find how many rows fall into this condition
Is there any other efficient way?</p>