Better way to write this in jQuery
<p>I am using the following script to filter out divs that do not contain text in an inbox. (Similar to friends tab on Facebook)</p>

<pre><code>$('#friend_search_form input').keyup(function(){
    var $searchString = $(this).val();
    $('.buddy').show();
    $('.buddy_name &gt; a:contains('+$searchString+')').closest('.buddy').hide();
    console.log($searchString);  
})
</code></pre>

<p>The problem is when  you are typing, it takes a lot of resources and get buggy.</p>

<p>What is the better way to write this?</p>
