Sunday, June 14, 2020

Apex Percent Usage

I wanted to check on how is Apex code counted towards the limit, considering we are only allowed 6,000,000 characters (6 MB ) and we might come across a situation where we may want to increase the aforementioned limit.

Salesforce allows you to increase limit upto 10,000,000 characters (10MB) on logging a case.

Salesforce doc

I have created a few scenarios to check on what all simple things contribute towards this usage.

After creating a dummy class below is apex usage, we would run different scenarios on below class to see how is apex usage changed.

  • Adding redundant new lines (/n) in the code doesn't impact the usage.
  • Adding redundant spaces/tab in between the code increases the usage.
  • Adding redundant spaces/tab even at the end of line increases the usage.
  • Adding spaces/tabs for indentation of code also seems to increase the usage(for demo purposes I have indented class variables only)
  • Adding comments in class don't impact the usage.

  • Creating a test class don't count towards apex usage ie redundant tabs/spaces none of them are counted.

  • Blank lines containing only spaces are also not counted towards the usage.

Note : Managed packages are not counted towards the limit as they belong to different namespace as that of your org.

Thanks for reading.

If you liked the post do support me by buying a pizza for me :D