+ Start a Discussion

Loading Time is slow????

Hi I have the following S-Control and then following the Iframe opening up at the Homepage as a component...
But it is slow to load the homepage when they sign in any one has any ideas how to make it fast...PLZZZ
<meta http-equiv=“refresh” content=“600″ /> 
<script type="text/javascript" src="/soap/ajax/10.0/connection.js"></script> 
<script type="text/javascript"> 
function init_page() 
var j= ""; 
var output=""; 
strSQL = "Select Id,AS400_Account_Number__c,Name,BillingCity,SF_DATE_ON_SERVICE__c from Account where OwnerId='{!$User.Id}' and SF_DATE_ON_SERVICE__c = LAST_N_DAYS:30 ORDER BY SF_DATE_ON_SERVICE__c DESC"; 
var result = sforce.connection.query(strSQL); 
var records = result.getArray("records"); 
for (var i=0; i<records.length; i++) 
j +='<a href="/' + records[i].Id + ' "target=_blank"">' + (i+1) +') ' + records[i].SF_DATE_ON_SERVICE__c + ' - ' + records[i].AS400_Account_Number__c + ' - ' + records[i].Name + ' - ' + records[i].BillingCity + '</a><br>&nbsp;' 
document.getElementById('div_tag').innerHTML = j ; 
<body bgcolor="#F3F3EC"> 
<font size="2" face="Verdana"> 
<div id="div_tag">No Accts</div></font> 

Usually the tool I use to debug loading times is a gem I found online called ServiceCapture.
Also helps me figure out the results to my SOQL queries without having to alert() 'em. YMMV.
How many records this query returns?

Your can improve perf by the following:

1. Use async invoke, so the browser is not blocked.

sforce.connection.query(soql, callback);

2. Instead of concating string, put the sub strings in to an array and join the array at the end.

3. Limit the max number of records to say 10 or 20.