My laptop is 10 times faster

This Salesforce blog post Apex Runtime Update for Developer Edition Orgs describes a significant change in how Developer Edition orgs execute Apex code, and this 3rd party blog post by Alex Berg Salesforce’s Apex Runtime Design – Old vs New provides more explanation. However I couldn’t find any statement about when this change will be rolled out into production orgs.

Before this change the performance of Apex when executing CPU intensive logic in an application was surprisingly poor – see My laptop is 300 times faster. The good news is that running the same test today in a na3 Developer Edition org multiple times (to allow bytecode caching) resulted in an average time of 208ms. Hence the new conclusion that my laptop is only 10 times faster.

This is a dramatic improvement, making a more practical platform for executing CPU intensive logic as long as the logic remains within the “total number of executed code statements” governor limit.


3 thoughts on “My laptop is 10 times faster

  1. Hi, I’m happy that you and others are noticing the new runtime and are excited about it. I decided to spend some time looking at your benchmark. One question: are you running this via the run test button on the class page? I ask because in the run test scenario we turn on the infrastructure to generate the debug logs and code coverage data and therefore there is some level of performance drop off. In production scenarios (aka when Apex gets run in a trigger, as a VF controller, in a batch job, etc.) we do not gather that extra data so performance is somewhat better. I made a minor alteration to your code to have it runnable as both a test and VF controller (see below) and I see it running significantly faster as a VF controller.

    global class CalcTest {

    static void test() {
    String result = new CalcTest().getTime();

    System.debug(‘executionTime=”‘ + result + ‘”‘);

    global String getTime() {
    Long t1 =;
    Integer result = calc(200);
    Long t2 =;
    return String.valueOf(t2-t1);

    private static Integer calc(Integer n) {
    Integer sum = 0;
    for (Integer i = 0; i < n; i++) {
    for (Integer j = 0; j < n; j++) {
    sum += i * j;
    return sum;

    This is your new Page

    • Greg,

      Yes I ran the code via the test button so its good news that production scenarios should be quicker. Perhaps you could write an “official” blog post about the improvements to properly show off what has been achieved?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s