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
StenEStenE 

Very slow visualforce after summer '12 upgrade

Hi,

 

I have an application on the AppExchange and several of my customers are complaining about very slow page loads or even page time outs. 

I did some debugging and found out that the following functions is causing the trouble. 

 

private List<SelectOption> cntcFlds;
public List<SelectOption> getContactFields() {
        
        if (cntcFlds == null) {
            List<SelectOption> options = new List<SelectOption>();
            options.add(new SelectOption('N/A','N/A'));
            Map<String, Schema.SObjectField> M = Schema.SObjectType.Contact.fields.getMap();
            for (Schema.SObjectField field: M.values()) {
                Schema.DescribeFieldResult F = field.getDescribe();
                if (F.isUpdateable()) {
                    options.add(new SelectOption(F.getName(),F.getLabel()));        
                }
            }
            cntcFlds = options;
            return options; 
        } else return cntcFlds;
        
    }

 

 But what is wrong with this function? Or did Salesforce changed the performance of the getDescribe functions?

 

Thanks,

Sten

 

 

 

sfdcKevinCsfdcKevinC

I spent a little time investigating this today, but to no avail. I timed your code substituting contact for a custom object with 500 custom fields and it executed fairly quickly on my dev machine ~120 ms. I don't think that would be a source of timeouts. Can you provide more info?


Can you post a bit of the debug log showing the slow times?

How many custom fields are there on Contact? Are there several of a certain type?

StenEStenE

Thanks for checking. 

 

In attached log file you see two invocations of two functions. GetLeadFields and GetContactFields. The latter is the funciton mentioned earlier and the first is the same function only on lead fields. 

 

In the log you can see that there is a difference in execution time of 27 seconds. 

 

LOG FILE

 

 

Thanks again,

Sten