Tag Archives: DF16

Dreamforce 2016: The Dark Art of CPU Benchmarking

FINALLY! Salesforce has released many of the Dreamforce 2016 sessions on YouTube.

I had the great privilege of working with Bobby at NimbleUser for a few years and was eagerly awaiting for this session to become available. It did not disappoint.

In this session, Bobby and Dan Appleman discuss how to benchmark how long a particular operation takes in terms of CPU usage, their findings with benchmarking various things and their recommendations about what to do in these situations, and the tradeoffs and considerations to keep in mind.

Benchmarking Highlights

  • Single assignment takes .035 microseconds. actId = sourceId;
  • Static field assignment takes .58 microseconds.
    • actId = ct.AccountId;
  • Dynamic Field Assignment take 18 microseconds. actId = ct.get(‘AccountId’); so assign this to a temporary variable first and then use the temporary variable.
  • The foreach loop is slower than using a traditional for loop like “for (Integer i = 0; i < count; i++) {}”. The foreach loop takes around 4 microseconds for simple assignment versus 0.75 microseconds with a traditional for loop. This is inline with my profiling results where a traditional for loop is roughly 4 times faster than the for each loop.
  • Validation Rule formula functions take roughly 30 milliseconds per invocation.
  • Workflow rules are more efficient than process builder equivalents.

Disclaimer

The above results may change over time as Salesforce changes their software, hardware, and other factors. These findings are based on their results using Summer 16 with the orgs they used. Your mileage may vary.

Other Nuggets

  • SearchTheForce is a website they created that uses Google to search the common Salesforce sites for keywords your looking for.
  • The code used in the benchmarking can be found at the DF16-Benchmarking GitHub repository.

Thank you Bobby and Dan for a great session!

What did you think of the session? What other sessions would you recommend?