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 the deployment of a
Custom object named
Property only to the
Profile - Gearset-test. Our filtering system allows you to be very specific, so rather than selecting the default 64 metadata types, you could customize the selection and only select the ones relevant to the change you're looking to make. In this case, we've selected the following:
Select just the top level metadata types (
Profile, I have used the slider to switch from
Named items, and only selected the
Same with the
Custom object as well. I have filtered the
Property object from the list so that only
Property object will be populated in the comparison, which makes this faster.
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 prioritize 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.
Try out our Compare now 2.0 Pilot feature
Gearset has traditionally requested all metadata for a metadata type(s) unless a more granular pre-comparison filter has been specified to retrieve fewer types or items (as specified above).
To improve comparison speed and deliver relevant metadata faster, Gearset is revamping its comparison process. This includes changes to the core engine for more efficient data retrieval, as well as a redesigned user interface that helps you focus on the metadata you need, saving you valuable time.
Try it out and if you have any feedback on this then let us know through the in-app chat.