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
Mohammed zabi 6Mohammed zabi 6 

Apex CPU Time exceeded

Hi All,

  I am having an issue with apex class and Visualforce page as "Apex CPU Time exceeded" I thought it is because of Large set of data will any once can give me better idea to resolve this error

Temoc MunozTemoc Munoz
Hi Mohammed.

Without any code snippets, we can't do much to help you out.

I can give you some pointers though:
1. Do you have nested loops? If so,are these really needed?
2. Try to use more efficient data structures like Maps.
3. If you have a traditional for loop (i.e. for(Integer i = 0; i < mylist.size(); i++)) change it to for(Integer i = 0, j = mylist.size(); i <  j; i++)
4. Are you calling the same function over and over again? If so, is this really needed?
5. Is your Visual Force Page composed of several components/extensions?

If you can provide some code, that would be helpful.