How can I improve performance of my javascript code
<p>I have a page with a list of items. Items have several actions assigned to them. (see screenshot). </p>

<p>One may choose to directly click on an icon next to each row or check a checkbox on the left hand side. </p>

<p>The issue is that after clicking an item OR checking a checkbox of several items and then clicking an action there is a lag (a second or so). Imagine having 100 rows or more.</p>

<p><img src="http://i.stack.imgur.com/pvZIb.png" alt="enter image description here"></p>

<p>How can I improve the performance of my javascript code?</p>

<p>sample HTML of one row:</p>

<pre><code>&lt;tr id="1960AGIMMGMRTB20314" class=""&gt;
                        &lt;td class="checkbox"&gt;
                                     &lt;input type="checkbox" value="1960" class="checkbox"&gt;     

                        &lt;/td&gt;
                        &lt;td class=""&gt;
                            &lt;p&gt;&lt;a href="/Devices/View/1960"&gt;GD009000246&lt;/a&gt;&lt;/p&gt;
                        &lt;/td&gt;
                        &lt;td class="platform"&gt;PCGames&lt;/td&gt;
                        &lt;td class="cat"&gt;Up&lt;/td&gt;
                        &lt;td class="platform"&gt;
                            &lt;div class="pbar"&gt;&lt;span class="progresslabel"&gt;&lt;/span&gt;&lt;/div&gt;
                        &lt;/td&gt;
                        &lt;td class="date"&gt;10.48.1.236&lt;/td&gt;   
                        &lt;td class="options clearfix"&gt;
                                    &lt;a title="" class="iconMagnifier tip" href="/Packages/View/AGI-MM-GM-RTB-2.0.3.1.4"&gt;View&lt;/a&gt;
&lt;a title="" href="/Packages/PackageActionAsyncDeletePackage" data-ajax-type="DeletePackage" data-ajax-packageid="AGI-MM-GM-RTB-2.0.3.1.4" data-ajax-machineid="1960" class="iconDelete action tip"&gt;Remove&lt;/a&gt;                            
                        &lt;/td&gt;       
                    &lt;/tr&gt;
</code></pre>

<p>javascript:</p>

<pre><code>     // action invoker
    $("a.action:not(.remove)").click(function (e) { // .remove =&gt; do not execute on download tasks page
        var obj = $(this);
        e.preventDefault();
        if (!$(this).hasClass('disablelink')) {
            var machineIds = getSelection(obj);
            if (machineIds.length &gt; 0) {
                packageAction(obj.attr("data-ajax-packageid"), machineIds, obj.attr("data-ajax-type"));
            };
        }
        $(".checkall").attr("checked", false);
    });

function getSelection(obj) {
    var selected = new Array();
    if (obj.attr('data-ajax-machineId')) {
        selected.push(obj.attr('data-ajax-machineId'));
    } else {
        $("input.checkbox:checkbox:checked:not(.checkall)").each(function () {
            var machineId = $(this).val();
            var packageId = obj.attr("data-ajax-packageid");
            var operation = obj.attr("data-ajax-type");
            if ($("#" + machineId + packageId.removeSpecialChars().toUpperCase() + "").size() != 0) {
                var row = $("#" + machineId + packageId.removeSpecialChars().toUpperCase() + "");
                row.has("a[data-ajax-type=" + operation + "]:not(.hide)").length ? selected.push(machineId) : $(this).attr('checked', false);
            }
        });
    }
    return selected;
}  

    // download, install, uninstall, remove, activate, deactivate package
    function packageAction(packageId, machineIds, operationType) {
.....// to implement - not needed
</code></pre>
