What is the best way to make this script less slow with or without jquery, the original function has more than 200 lines of changes, and is applied on a page where there are an average of 1000 to 1500 tags to change.
How can you leave the comparison to create a faster link?
function crLink(){
var $tbl = $('#frame').find("table[title^='TITULO']");
$tbl.find("b:contains(CNF)").html(" - LINK <a href='http://www.minasgerais.com.br' target='_blank'><b><font color='blue'>CONFINS </font></b></a>");
$tbl.find("b:contains(BSB)").html(" - LINK <a href='http://www.df.com.br' target='_blank'><b><font color='blue'>BRASILIA </font></b></a>");
$tbl.find("b:contains(SSA)").html(" - LINK <a href='http://www.bahia.com.br' target='_blank'><b><font color='blue'>SALVADOR </font></b></a>");
$tbl.find("b:contains(CGH)").html(" - LINK <a href='http://www.saopaulo.com.br' target='_blank'><b><font color='blue'>CONGONHAS </font></b></a>");
$tbl.find("b:contains(SDU)").html(" - LINK <a href='http://www.riodejaneiro.com.br' target='_blank'><b><font color='blue'>RIO DE JANEIRO </font></b></a>");
$tbl.find("b:contains(JTC)").html(" - LINK <a href='http://www.saopaulo.com.br' target='_blank'><b><font color='blue'>BAURU </font></b></a>");
$tbl.find("b:contains(PMW)").html(" - LINK <a href='http://www.tocantins.com.br' target='_blank'><b><font color='blue'>PALMAS </font></b></a>");
}
When run on the page with more than 1000 tags to change is with a delay of up to 15 seconds to be applied. Here is an example:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script><html><head><scripttype="text/javascript" src="inc/jquery.js"></script>
<script>
function crLink(){
var $tbl = $('#frame').find("table[title^='TITULO']");
$tbl.find("b:contains(CNF)").html(" - LINK <a href='http://www.minasgerais.com.br' target='_blank'><b><font color='blue'>CONFINS </font></b></a>");
$tbl.find("b:contains(BSB)").html(" - LINK <a href='http://www.df.com.br' target='_blank'><b><font color='blue'>BRASILIA </font></b></a>");
$tbl.find("b:contains(SSA)").html(" - LINK <a href='http://www.bahia.com.br' target='_blank'><b><font color='blue'>SALVADOR </font></b></a>");
$tbl.find("b:contains(CGH)").html(" - LINK <a href='http://www.saopaulo.com.br' target='_blank'><b><font color='blue'>CONGONHAS </font></b></a>");
$tbl.find("b:contains(SDU)").html(" - LINK <a href='http://www.riodejaneiro.com.br' target='_blank'><b><font color='blue'>RIO DE JANEIRO </font></b></a>");
$tbl.find("b:contains(JTC)").html(" - LINK <a href='http://www.saopaulo.com.br' target='_blank'><b><font color='blue'>BAURU </font></b></a>");
$tbl.find("b:contains(PMW)").html(" - LINK <a href='http://www.tocantins.com.br' target='_blank'><b><font color='blue'>PALMAS </font></b></a>");
}
</script>
</head>
<body>
<button onclick="crLink()">BOTAO</button>
<div id="frame">
<table title="TITULO">
<tbody>
<tr>
<td><b>joao xx xxxxx</b></td><td><b>150</b></td><td><b>CNF</b></td>
</tr> <tr>
<td><b>maria xx xxxxx</b></td><td><b>110</b></td><td><b>BSB</b></td>
</tr> <tr>
<td><b>ana xx xxxxx</b></td><td><b>190</b></td><td><b>SSA</b></td>
</tr> <tr>
<td><b>mario xx xxxxxxx</b></td><td><b>100</b></td><td><b>CNF</b></td>
</tr> <tr>
<td><b>claudia xxxxxxx</b></td><td><b>170</b></td><td><b>SDU</b></td>
</tr> <tr>
<td><b>ricardo xx xxxxxx</b></td><td><b>160</b></td><td><b>SDU</b></td>
</tr> <tr>
<td><b>eder xx xxxxxx</b></td><td><b>300</b></td><td><b>CNF</b></td>
</tr> <tr>
<td><b>julia xx xxxxx</b></td><td><b>130</b></td><td><b>SSA</b></td>
</tr> <tr>
<td><b>mara xxx xxxxx</b></td><td><b>200</b></td><td><b>JTC</b></td>
</tr> <tr>
<td><b>lara xxx xxxxx</b></td><td><b>100</b></td><td><b>BSB</b></td>
</tr> <tr>
<td><b>beto xxx xxxxx</b></td><td><b>150</b></td><td><b>JTC</b></td>
</tr> <tr>
<td><b>fabio xxx xxxxx</b></td><td><b>170</b></td><td><b>PMW</b></td>
</tr> <tr>
<td><b>juliano xxx xxxxx</b></td><td><b>110</b></td><td><b>BSB</b></td>
</tr> <tr>
<td><b>marisa xxx xxxxx</b></td><td><b>400</b></td><td><b>CGH</b></td>
</tr> <tr>
<td><b>selena xxx xxxxx</b></td><td><b>160</b></td><td><b>JTC</b></td>
</tr>
</tbody>
</table>
</div>
</body>
</html>