Understanding what makes up a comparison
When you hit
COMPARE NOW for a metadata deployment, the following happens:
Connection established to the selected org via OAuth 2.0
Downloading and retrieving metadata via the Salesforce Metadata API
Caching the metadata
Comparison is initialized and displayed
Of course, this has to be run once for each org: once for the source and once for the target. These are run in parallel in order to reduce the time it takes as much as possible. It's stage two that takes the most time, so that's what we'll need to look at.
Factors to consider
If your metadata comparison is taking a while to load, there are essentially two contributing factors to consider:
The current load on Salesforce servers
The amount of metadata being requested
During peak hours in the US, when the greatest number of users are active on the Salesforce platform, the speed of the service slows down. Unfortunately, there isn't anything that can be done to speed this part up - we're reliant on how quickly the Salesforce Metadata API is able to retrieve your metadata.
If you'd be interested in testing the Salesforce API download speeds outside of Gearset, you are able to do this with Workbench. We have an article on this here.
Aside from server limitations, there is a way that you can significantly decrease the time it takes to run a comparison. This is achieved by reducing the amount of metadata being requested in the first place.
Using filters to reduce metadata selection
Without a doubt, the largest factor in determining the speed of your comparison is the amount of metadata that's been selected in the filters.
Reduce the metadata types
You may have already noticed that our default filter selection only includes 64 metadata types; this will already be a dramatic improvement over using the
Compare all selection. However, to further improve, we recommend that you reduce this selection and only include the metadata types that you need. The more you remove, the less unnecessary metadata will need to be retrieved, and the faster it'll be.
Reduce the named items
You can also use the
Named items filter to narrow down which items to compare within a metadata type. Instead of comparing all metadata items within a single metadata type, this will reduce the request to only specific items.
As well as simply selecting checkboxes, you can use regex filtering in
Named items, described in this support article.
As an example, let's take a deployment of
Profile: Flow Access for just the
Admin profile. Our filtering system allows you to be very specific, so rather than selecting the default 64 metadata types, you could customise the selection and only select the ones relevant to the change you're looking to make. In this case, we've selected the following:
Selected just the top level metadata types (
Profile, I've used the slider to switch from
Named items, and only selected the
You should find that reducing the filter selection like this reduces your comparison time. For full details on how to utilize custom metadata filters, we have a general support article on managing them here.
Should I enable "Source Tracking" in my org?
Our advice would be to enable this, details on how you go about this can be found in this Salesforce documentation. Source tracking within your sandbox can improve the efficiency of comparisons within Gearset.
To briefly explain what this functionality does, it helps us to prioritise and understand which metadata has been modified/added/deleted since the last time there was a retrieval from your org. If there hasn't been any changes to particular components, then there isn't a need to download them again the next time you run a comparison. We'll just use the last downloaded version from your org, saving time.
As we've explained in this article, the less metadata we need to download, the faster your comparison will be to load.
Gearset update as of the 23rd of May 2022
At Gearset we're always striving to improve the functionality and usability of our tool. To that end, we're pleased to announce that we've now released a feature called "Live Comparisons". If you're interested in learning more about this release, please see both our blog post and support document on this topic.