Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Package Genration takes one hour when profiles are involved] #1022

Open
1 task
sachin-in opened this issue Feb 19, 2025 · 8 comments
Open
1 task

[Package Genration takes one hour when profiles are involved] #1022

sachin-in opened this issue Feb 19, 2025 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@sachin-in
Copy link

sachin-in commented Feb 19, 2025

Issue verification check:

  • is the current repository fully deployable at the commit SHA provided with the 'from' parameter of the command?

What is the problem?

---Package generation takes one hour when profiles are involved

We have two salesforce prod orgs, their respective repos are hosted on two different platforms one is on gitlab and other is on azure devops, now the gitlab repo works fine but when we have any changes in profiles from azure devops repo then it takes 1 hour for the sgd plugin to create the package (one hour for all profiles, less time depends on number of profiles).

What is the parameter and the value you used with it?

Ex: $ sfdx sgd:source:delta --to HEAD --from HEAD^ --output changes/

What is the expected result?

Expected results are good, it's just the times takes in generating said results that's the issue

Image
Package is generated in validate code stage

What is the actual result?

---Same as expected

Steps to reproduce


Cannot share source code or repo URL here

Execution context


Operating System: … Windows 11

npm version: …10.8.2

node version: …22.5.0

git version: …2.45.2.windows.1

sf version: …2.74.6

sgd plugin version: …6.3.0

More information (optional)


@sachin-in sachin-in added the bug Something isn't working label Feb 19, 2025
@sachin-in sachin-in marked this as a duplicate of #1021 Feb 19, 2025
@scolladon
Copy link
Owner

Hi @sachin-in!

Thanks for raising this issue and thanks for contributing in making this project better!

Do you reproduce this performance issue on your laptop (with the same command, same version of and plugins, and the same repository) ?
Or is it a performance issue from the azure devops container ?

@sachin-in
Copy link
Author

HI @scolladon, we are getting this in our jenkins pipeline and laptop both, command and versions are same, OS differs, jenkins is hosted on Azure cloud with linux OS

@scolladon
Copy link
Owner

It takes ~1h also on your laptop ?

Profiles must be huged...
I can suggest to convert those profiles to permission sets, but that's not the point and I'm pretty sure you know that already 😅

Could you share one of those huge profiles ? and also an example of diff to consider ?
I'd like to debug this actual scenario in your shoes as much as possible.
If you could give me access to the repo and give an exemple of 2 commits to compare that would be best.

@sachin-in
Copy link
Author

It takes ~1h also on your laptop ?

Profiles must be huged... I can suggest to convert those profiles to permission sets, but that's not the point and I'm pretty sure you know that already 😅

Could you share one of those huge profiles ? and also an example of diff to consider ? I'd like to debug this actual scenario in your shoes as much as possible. If you could give me access to the repo and give an exemple of 2 commits to compare that would be best.


This is the Diff
force-app/main/default/classes/OppDealQualificationTrigger_Handler.cls
force-app/main/default/classes/OppDealQualificationTrigger_Handler_Test.cls
force-app/main/default/classes/OpportunityTrigger_Handler.cls
force-app/main/default/flexipages/Deal_Qualification_Record_Page.flexipage-meta.xml
force-app/main/default/layouts/Opportunity_Deal_qualification__c-Deal Qualification Layout.layout-meta.xml
force-app/main/default/objects/Opportunity_Deal_qualification__c/fields/Deal_Review__c.field-meta.xml
force-app/main/default/objects/Opportunity_Deal_qualification__c/fields/Deal_review_notes__c.field-meta.xml
force-app/main/default/objects/Opportunity_Deal_qualification__c/fields/Discount_guidance__c.field-meta.xml
force-app/main/default/objects/Opportunity_Deal_qualification__c/fields/How_was_price_set__c.field-meta.xml
force-app/main/default/objects/Opportunity_Deal_qualification__c/fields/Superseded_Revenue__c.field-meta.xml
force-app/main/default/permissionsetgroups/Power_Business_Ops_Group.permissionsetgroup-meta.xml
force-app/main/default/profiles/Account Operations.profile-meta.xml
force-app/main/default/profiles/Admin Support.profile-meta.xml
force-app/main/default/profiles/Admin.profile-meta.xml
force-app/main/default/profiles/BDR.profile-meta.xml
force-app/main/default/profiles/Bid Manager.profile-meta.xml
force-app/main/default/profiles/Channel Sales Rep.profile-meta.xml
force-app/main/default/profiles/Contract Team.profile-meta.xml
force-app/main/default/profiles/ContractManager.profile-meta.xml
force-app/main/default/profiles/Customer Success Manager.profile-meta.xml
force-app/main/default/profiles/Deal Desk.profile-meta.xml
force-app/main/default/profiles/General User.profile-meta.xml
force-app/main/default/profiles/Hybrid CSM-sales Rep.profile-meta.xml
force-app/main/default/profiles/LDR.profile-meta.xml
force-app/main/default/profiles/Legal.profile-meta.xml
force-app/main/default/profiles/MFI Marketing.profile-meta.xml
force-app/main/default/profiles/Marketing Operations.profile-meta.xml
force-app/main/default/profiles/MarketingProfile.profile-meta.xml
force-app/main/default/profiles/Micro Focus Read-Only.profile-meta.xml
force-app/main/default/profiles/Minimum Access - Salesforce.profile-meta.xml
force-app/main/default/profiles/Partner Operations.profile-meta.xml
force-app/main/default/profiles/Power Business Ops.profile-meta.xml
force-app/main/default/profiles/Premium Ops Team.profile-meta.xml
force-app/main/default/profiles/Premium Service Agent.profile-meta.xml
force-app/main/default/profiles/Premium Service Manager.profile-meta.xml
force-app/main/default/profiles/Product Marketing Profile.profile-meta.xml
force-app/main/default/profiles/Quote Operations.profile-meta.xml
force-app/main/default/profiles/Read Only.profile-meta.xml
force-app/main/default/profiles/Sales Operations Manager.profile-meta.xml
force-app/main/default/profiles/Sales Rep.profile-meta.xml
force-app/main/default/profiles/Service Administrator.profile-meta.xml
force-app/main/default/profiles/Service Agent Lite.profile-meta.xml
force-app/main/default/profiles/Service Agent.profile-meta.xml
force-app/main/default/profiles/Service Manager.profile-meta.xml
force-app/main/default/profiles/SolutionManager.profile-meta.xml
force-app/main/default/profiles/Standard.profile-meta.xml
force-app/main/default/triggers/Deal_Qualification_Trigger.trigger
force-app/main/default/uiFormatSpecificationSets/CustomerBudgetApproved.uiFormatSpecificationSet-meta.xml
force-app/main/default/uiFormatSpecificationSets/DecisionProcess.uiFormatSpecificationSet-meta.xml
force-app/main/default/uiFormatSpecificationSets/HowWasPriceSet.uiFormatSpecificationSet-meta.xml
force-app/main/default/uiFormatSpecificationSets/NextStep.uiFormatSpecificationSet-meta.xml
force-app/main/default/uiFormatSpecificationSets/PrimaryCompetitor.uiFormatSpecificationSet-meta.xml
force-app/main/default/uiFormatSpecificationSets/ProcurementProcess_timeline.uiFormatSpecificationSet-meta.xml
force-app/main/default/uiFormatSpecificationSets/TechnicalWin.uiFormatSpecificationSet-meta.xml
force-app/main/default/uiFormatSpecificationSets/ValueToCustomer.uiFormatSpecificationSet-meta.xml
force-app/main/default/uiFormatSpecificationSets/WhyChange.uiFormatSpecificationSet-meta.xml
force-app/main/default/uiFormatSpecificationSets/WhyNow.uiFormatSpecificationSet-meta.xml
force-app/main/default/uiFormatSpecificationSets/WhyOpenText.uiFormatSpecificationSet-meta.xml

Attached the admin profile here, most profiles are similar in size.
Admin.txt

I cannot provide the repo access because it's a corp repo

@scolladon
Copy link
Owner

Thank you very much !

Wow, 82,000 lines — that’s massive! No wonder my IDE is struggling. With a file of this size, it’s expected that sgd might take longer to process. Let me quickly explain why:

  1. sgd reads the file.
  2. It converts the XML to JSON (this happens twice).
  3. It compares the two revisions.
  4. Lastly, it rebuilds the XML file with the delta.

Given this extensive process, the performance hit is understandable. That said, here are some suggestions that might help with this situation:

  1. Performance Debugging: Could you provide us with a performance dump (node --inspect-brk $(which sf) sgd command --flags)? This would allow us to analyze where most of the time is being spent and explore potential optimizations.

  2. Workaround: You could add all profiles to the .sgdignore file to exclude them from delta processing. Afterward, you can manually add the profile files to the output directory and deploy them alongside the other metadata. This will deploy the full profile (which may take longer during deployment) but will significantly reduce sgd execution time.

  3. New Parameter: We’re considering introducing a new parameter to bypass the in-file exploration step for scenarios like yours. This would generate larger output files more quickly—if that seems useful to you, we’d love your feedback!

Let us know how you’d like to proceed or if you need further clarification. Thanks again for sharing this use case—it really helps us improve!

@cvidalbucher
Copy link

We are having same issue as other have mentioned. Our org has big profiles so every diff lasts like15 mins.

@scolladon
Copy link
Owner

Sorry to hear that @cvidalbucher

Could you help by providing either a reproduction repository or by prodividing a performance dump please ? cf my previous comment

@cvidalbucher
Copy link

Cant disclose that information but just like others i have profiles with more than 30000 lines of code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants