function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NaishadhNaishadh 

VF Page Performance Issue

Hi,

I have two visual Force pages and one apex class. Both are the pages method are simplay fetching 10 to 15 records from Salesforce and display it. Please suggest which option is better.

1. Use standard component and extension attribute in <apex:page>

2. Use controller method attribute in <apex:page>.

It may be a silly question but page is taking too much time while loading.  Please help!
David VPDavid VP

Using a controller or controller extension shouldn't really have any significant impact on performance. You could go either way.

If your page is slow, it's due to something else. Can you share your code ?

 

David

NaishadhNaishadh

Hi,

 

Thanks for reply. Here is my code.

 

 

public class SPOTController { public String spotId { get; set;} private final ApexPages.StandardController controller; List<xtma_Individual_Email_Result__c> emailResultList; List<CampaignMember> campaignMemList; /*public SPOTController() { }*/ public SPOTController(ApexPages.StandardController controller) { this.controller = controller; } public void loadEmailResults() { spotId = ApexPages.currentPage().getParameters().get('id'); emailResultList = new List<xtma_Individual_Email_Result__c> ([Select x.Name, x.Lead__r.Name, x.Lead__c, x.Id, x.Contact__r.Name, x.Contact__c,x.From_Address__c, x.Number_of_Total_Clicks__c, x.Date_Time_Sent__c, x.Date_Time_Opened__c From xtma_Individual_Email_Result__c x where x.Lead__r.SPOT_Profile__c = :spotId or x.Contact__r.SPOT_Profile__c = :spotId]); } public List<xtma_Individual_Email_Result__c> getEmailResultList() { loadEmailResults(); return emailResultList; } public void loadCampaignData() { spotId = ApexPages.currentPage().getParameters().get('id'); campaignMemList = new List<CampaignMember> ([Select c.Status, c.LeadId,c.Lead.Name, c.Id, c.Campaign.Segment__c, c.LastModifiedDate,c.Contact.Name, c.ContactId, c.Campaign.Name, c.CampaignId From CampaignMember c where c.Lead.SPOT_Profile__c = :spotId or c.Contact.SPOT_Profile__c = :spotId]); } public List<CampaignMember> getCampaignMemList() { loadCampaignData(); return campaignMemList; } }

 

<apex:page standardController="SPOT_Profile__c" extensions="SPOTController" showHeader="false" sidebar="false" tabStyle="SPOT_Profile__c"> <apex:form > <apex:inputhidden value="{!spotId}"/> <apex:pageblock > <apex:pageBlockTable value="{!campaignMemList}" var="campObj"> <apex:column headerValue="Lead"> <apex:outputLink value="/{!campObj.LeadId}" target="_blank">{!campObj.Lead.Name}</apex:outputLink> </apex:column> <apex:column headerValue="Contact"> <apex:outputLink value="/{!campObj.ContactId}" target="_blank">{!campObj.Contact.Name}</apex:outputLink> </apex:column> <apex:column headerValue="Campaign Name"> <apex:outputLink value="/{!campObj.CampaignId}" target="_blank">{!campObj.Campaign.Name}</apex:outputLink> </apex:column> <apex:column headerValue="Status"> <apex:outputLabel >{!campObj.Status}</apex:outputLabel> </apex:column> <apex:column headerValue="Member Status Updated"> <apex:outputLabel >{!campObj.LastModifiedDate}</apex:outputLabel> </apex:column> <apex:column headerValue="SunGard Segment"> <apex:outputLabel >{!campObj.Campaign.Segment__c}</apex:outputLabel> </apex:column> </apex:pageBlockTable> </apex:pageblock> </apex:form> </apex:page>

 

<apex:page standardController="SPOT_Profile__c" extensions="SPOTController" showHeader="false" sidebar="false" tabStyle="SPOT_Profile__c"> <apex:form > <apex:inputhidden value="{!spotId}"/> <apex:pageblock > <apex:pageBlockTable value="{!emailResultList}" var="emailObj"> <apex:column headerValue="Lead"> <apex:outputLink value="/{!emailObj.Lead__c}" target="_blank">{!emailObj.Lead__r.Name}</apex:outputLink> </apex:column> <apex:column headerValue="Contact"> <apex:outputLink value="/{!emailObj.Contact__c}" target="_blank">{!emailObj.Contact__r.Name}</apex:outputLink> </apex:column> <apex:column headerValue="Email Name"> <apex:outputLink value="/{!emailObj.Id}" target="_blank">{!emailObj.Name}</apex:outputLink> </apex:column> <apex:column headerValue="Date Opened"> <apex:outputLabel >{!emailObj.Date_Time_Opened__c}</apex:outputLabel> </apex:column> <apex:column headerValue="Date Sent"> <apex:outputLabel >{!emailObj.Date_Time_Sent__c}</apex:outputLabel> </apex:column> <apex:column headerValue="Total Clicks"> <apex:outputLabel >{!emailObj.Number_of_Total_Clicks__c}</apex:outputLabel> </apex:column> <apex:column headerValue="From Address"> <apex:outputLabel >{!emailObj.From_Address__c}</apex:outputLabel> </apex:column> </apex:pageBlockTable> </apex:pageblock> </apex:form> </apex:page>

 

 

 

 

 

David VPDavid VP

Looks like it shouldn't be a problem.

Where is it slow ?

Are you pulling on large amounts of data and showing them all on the screen ? What is the size of your generated HTML page ? Are you using anything like Firebug or other add-ins to your browser that monitor the DOM / Javascript ... these can slow things down considerably, especially with large pages.

Do page that don't query load slow too (could be a bandwidth problem). ?

 

Do you have a lot of data in the org (in your EmailResult__c object) ?

 

NaishadhNaishadh

I have checked the same in all three browser i.e. IE,firefox and google crome. All have the same issue.

 

I am not using any firebug or add-in in browser.

 

I am working on 1gbps  broad band line.

 

In Email results, total number of records are approximately 1,300,000.