Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 6
    Note that the 200ms variance represents a traditional problem in multi-tasking systems. The time spent in Apex Code is wall-clock time and not actual CPU time spent. This means that the system task scheduler (the OS) will influence the wall clock time through the process of multitasking. This is outside the influence of any programming language. Commented Oct 16, 2013 at 13:05
  • 2
    Also, I've observed that for simple tasks, it's now possible to get up to 3,000,000 script statements executed before a limit exception, an increase of 15x. Commented Oct 16, 2013 at 13:59
  • 7
    The move from a script statement limit to a CPU limit will provide more flexibility in most cases, but not all. I have this line of code in a trigger if (myNewObject != myOldObject), which was written with the script statement limit in mind so that we didnt have to iterate over every field on the custom object (there's 200) in the trigger to compare the old value with the new value. We are comparing the old and new object instead which uses up 1 script statement but was actually using 10ms approx of CPU time. It blows up with 1000+ records now. Commented Oct 16, 2013 at 17:42
  • @BarCotter Is it common to have 1000+ items in a trigger? And why over 200 fields? It sounds like an optimization problem on salesforce's part, though, it shouldn't take 10ms to compare two records like that. It'll be fun to try and figure out how to optimize now. Commented Oct 23, 2013 at 3:09
  • 3
    (2) Also, have you noticed that the Governor Limit of 10,000 ms isn't strictly enforced? My tests suggest you can push the limit by ~50% consistently. Commented Oct 23, 2013 at 19:35