Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [performance]

The tag has no usage guidance.

1
vote
2answers
42 views

How can I efficiently loop through opportunities on a list of accounts?

Currently we have a few nested for loops in our codebase that are doing what is mentioned in the question, but if we data load a large amount of records we run into CPU time errors. I am wanting to ...
4
votes
0answers
75 views

Apex trigger takes a lot of time to access items in list

I have a simple Contact trigger in a sandbox org that is exhibiting some serious performance issues. After doing some debugging it looks like the issue boils down to accessing the items inside Trigger....
3
votes
0answers
20 views

Instance Switching

Has anyone had experience in requesting a Salesforce org be migrated from a different geographic instance to another? Our org was setup a number of years ago (10+) by someone in our US office. Our US ...
0
votes
1answer
33 views

Is there a better way to create related records when creating test data?

I am trying to create a large set of test data along with child records and this is what i came up with. Could anyone let me know if there's a better way to achieve the same? Integer countStart = ...
10
votes
2answers
184 views

Access to SObject Schema in Apex is very slow after API v44

We needs to use Schema and DescribeSObjectResult classes to get all SObject in the user's organization. But we noticed performance problem after upgraded to API v44. The following code could reproduce ...
10
votes
1answer
141 views

Drawbacks of using SObjectField.toString() over SObjectField.getDescribe().getName()

I often do '' + field where field is an SObjectField to get the field's API name. I like that much more than the clunky verbose field.getDescribe().getName(). So is there a reason I should not do it ...
1
vote
1answer
38 views

How do I optimize searching 3,000 records for an email that matches one on a lead?

Scenario A New Lead is inserted, if it matches criteria, the lead ownerid is Updated based on an email field on the lead. Problem Write code that takes the email address and queries all Users for ...
1
vote
1answer
36 views

Optimize code by reducing many If-else Conditions?

If-else code which I have written. I want to optimize it. (Using maybe Collection). Can someone show me how to do it? if(form.first_name.value == '' && form.last_name.value == '' &&...
7
votes
1answer
80 views

Slow scratch orgs causing Apex CPU time limit to be hit about 20% of the time - any workarounds?

We have an SFDX build set up that runs our 2,800 tests against 6 different scratch org configurations in parallel. But every build fails on what seems like a random one of the scratch orgs (i.e. it ...
0
votes
2answers
30 views

Is there any other impact of using serial bulkUpdate/Insert other than slow speed?

I am using the serial mode of bulkUpdate/Insert. I am just wondering if there any other impacts apart from the speed.
1
vote
2answers
106 views

Does more logic on Client side reduces the lightning performance?

I am just struggling to understand on this as I develop a lightning component. I have object rows from apex controller which gets displayed on the component using <table>, <tr> and <td&...
1
vote
1answer
52 views

Winter'19 Release: “Opportunities: Retain Edit Rights for Previous Opportunity Owners”

This is a useful feature in some situations: https://releasenotes.docs.salesforce.com/en-us/winter19/release-notes/rn_sales_features_core_oppty_sfx.htm But this can literally double the share table ...
5
votes
0answers
37 views

How to improve performance when querying CustomMetadata's FieldDefinition fields

When I query string columns on custom metadata objects, I get decent performance. However, if I query a column that points to a FieldDefinition, my query became much slower. Is this a known system ...
6
votes
2answers
116 views

Query optimization for ContentVersion

For a project I wrote a query to get all needed ContentVersion records. But after the deployment to full sandbox we have seen the performance issues with it. It only happens for the first time, all ...
3
votes
3answers
107 views

Performance profiling best practices

Given that: debug statements consume memory and cpu resources and thus skew performance measurements developer console in profiling perspective shows just events that were logged debug log size is ...
15
votes
4answers
949 views

Why are foreach loops slower in Apex than standard for loop?

Considering the following test class: @IsTest private class ProfilingTest { private static String TEST_STR = ''; public static testMethod void testForEachLoop(){ List<Account> ...
0
votes
2answers
41 views

Need solution on query optimaisation

i have below code where i am doing 2 queries and updating the account record. list<account> parentAccount=new list<account>(); list<account> ChildAccount=new list<account>(); ...
1
vote
2answers
60 views

Apex batch job performance

I am salesforce admin currently facing performance issue with one of the 3rd party(classy-SF) Integration. Batch job installed from classy are running 300+ times in 24 hours( batch size 1).Each batch ...
0
votes
0answers
46 views

How to make hierarchy more dynamic

Currently when creating my custom object data i have to go through a hierarchy of my account custom account team(PFI_Team__c) to bring the team data dynamically. Below is the hierarchy check pfi ...
1
vote
2answers
309 views

Optimize to avoid too many soql

is there a way to optimize this more? for(Program_Standard__c comp: comps) { List<CertificateComplianceAssociation__c> tempAsocs = [ SELECT Id, Certificate_Type__c, ...
2
votes
2answers
65 views

Performance of SOQL query loop and SOQL query assignment to map

I need to fetch orders by account. Since orders are children of account I can use the aggregation query parent-to-child. Query to be used: SELECT Id, (SELECT Id FROM Orders) FROM Account I can ...
0
votes
1answer
45 views

Optimise Double For Loops in Batch Apex

global Database.QueryLocator start(Database.BatchableContext BC) { return Database.getQueryLocator([SELECT id, (SELECT id, Status, Description, ...
0
votes
0answers
203 views

Lightning Component in Visualforce - Slow Loading in Spring/Summer 18

I know there was the same question in Summer 16 (Lightning Component in VFP - slow loading since Summer 16), but it seems to be the case again in Spring 18 and Summer 18 (I've tested this in sandbox ...
1
vote
1answer
51 views

Cross-Object Formula Fields and Performance

I have been unable to find official documentation about this. But I wonder, is there a documented "upper bound" count at which platform performance degradation occurs due to a proliferation of cross-...
15
votes
1answer
517 views

Why is Schema.describeSObjects(types) Slower Than Schema.getGlobalDescribe()?

I was about to reconfigure some of my code to use the newer Schema.describeSObjects(types) method that I had heard was faster than using a globalDescribe. I made some code to quickly check this and ...
0
votes
1answer
15 views

Send Email Additional To Fields when Millions of Contact

Here is the problem I am facing , I have 1 Millions of Contact While Sending email there is Field called Additional To Which Opens up the Contacts List Page It takes good amount of time to load this ...
3
votes
2answers
355 views

Performance-wise, is it better to query a relationship field or a formula field?

Like AccountName vs Account.Name. The first being a formula field, and the second one a relationship. Since formula fields are like Schrödinger's Cat (the value depends on the time you are getting ...
1
vote
1answer
30 views

How to optimize performance for dynamically add row & delete row functionality in VF Page

It is general scenario to create functionality of add and delete row dynamically. You can refer following link for better understanding of scenario: http://www.infallibletechie.com/2012/06/...
5
votes
1answer
533 views

Writing too much to debug log increases heap and cpu time

I have just observed that writing to debug log using System.debug increases heap size as well as CPU time. Is this normal. Please see the screenshot below for the comparison. The first one with so ...
4
votes
2answers
351 views

Formula field in SOQL - Performance Impact

Scenario Let's say I have two custom obejcts - Student and Class. The Class object is connected with object Student through lookup relationship. The Class object also has a formula field (...
1
vote
1answer
79 views

Is that possible to enqueue more than one action? Please suggest

I just read the best practices article for the Lightning and I am wondering is that possible to have more than one enqueueaction in client controller js? Please suggest. There is some hint given in ...
8
votes
1answer
670 views

How to implement a professional infinite/virtual scrolling in Lightning

I have a custom Lightning grid component (like and editable lightning:datatable) for which I need infinite scrolling to display thousands of rows without bringing the customers browser to a halt. I ...
1
vote
1answer
247 views

Reduce servertime loading dynamic piclist on community page

How do I reduce servercall load/time from a community. I build a dynamic picklist component which loads on the page as checkboxes. I use this component 5 times on the page. It takes about (3000ms) ...
10
votes
0answers
171 views

Why is my Lightning App inside a Managed Package extremly slow during its bootstrap phase (but not in the DEV org)?

I do have a managed package that contains a Lightning app (myApp.app) which contains various custom Lightning components. When I install the package in any org and open the app, it takes a very long ...
9
votes
1answer
206 views

What is the performance penalty for Deterministic Platform Encryption?

Spring 18 included a beta release of deterministic encryption for the SFDC Shield Platform Encryption product. Deterministic encryption imposes fewer issues with your existing code base / metadata ...
4
votes
2answers
98 views

Bulk deletion of Case Team Member records, data skew, and performance issues

We're proposing to delete no-longer-relevant Case Team Member records, numbering about 4.3 million (2.8 million total Cases). I'm concerned about the performance implications that might be caused by ...
14
votes
2answers
877 views

Effectively profile & speed up slow Lightning components (using Chrome Lightning Inspector)

Note: 5 years ago I asked the same about Visualforce here and it helped to collect a lot of knowledge. So let me try this again for Lightning. I am currently working on a quite complex Lightning page ...
0
votes
1answer
27 views

Advice for optimizing my search for available times for user(s) given list of their events. (Currently using for loop inside while loop) [closed]

I am finding the next 5 available time slots for a user or group of users based on events they have on their calendar. Currently, I have a while loop that will start at the selected time, then loop ...
3
votes
0answers
52 views

First event/event relation insert taking a while

I have an application that inserts events and event relations in an org's database and has a loading icon to prevent the user from doing anything until the event and relations are properly created and ...
7
votes
1answer
354 views

How exactly SOQL query time out works?

I have two Apex classes implementing Schedulable and Batchable as follows: Class implementing Schedulable interface: public class ScheduleClass implements Schedulable { public void execute(...
0
votes
1answer
96 views

Empty Your Recycle Bin Performance

Empty Your Recycle Bin or Empty Your Organization's Recycle Bin works very slow. Is there some faster way to empty the salesforce recycle bin.
8
votes
0answers
229 views

Make custom, in-memory “Lightning Data Service” work

Lightning Data Service is great. Multiple components are magically linked to database records. When records change in the db component show that change. Imagine this to work without saving change to ...
4
votes
1answer
60 views

In a Salesforce Number field, how much performance impact does its length have?

Does a 2,2 field perform noticeably better than a 16,2 if the same value (e.g. 24.45) is stored in the context of Apex DML Formulas whatever I forgot, please add To clarify: This question ...
0
votes
1answer
92 views

Query for non openers from several emails timing out

I can write some SQL, but I'm not good at knowing how to make things perform better. My query below works with one JobID, but I need to pull openers from 5 jobs. When I do this it times out. I'm ...
6
votes
2answers
361 views

Lightning Component Memory Leak Issue

Not sure if this is a Lightning bug. One of my Lightning pages consume lots of memory (around 4GB) when processing 4000+ records. I found out that the root cause is : when using component.set to ...
2
votes
2answers
133 views

Best Practice for bulk removeEnd() edits

I have 35+ words that I need to search for within a string. If the string ENDS with any of the 35+ words then I need to remove them. I am using .removeEnd() and it works great. My issue is my method ...
4
votes
1answer
129 views

Apex Trigger: Is it better to update the current collection or create a new collection with only the records that meet the conditions?

Wanted to see what the 'better' practice is or which would provide better performance. Let's say I have a trigger like this: trigger ProjectTrigger on Project__c (after update) { ...
0
votes
1answer
48 views

Getting CPU time error

I tried to make use of maps but still getting CPU time error. Code: //@AuraEnabled public static Map<String, Integer> getDateRangeMap() { Map<String, Integer> mapToReturn = new Map&...
0
votes
2answers
42 views

Iterating with Map with Keys vs Values . Which is more efficient?

Iterating with Map with Keys vs Values : As in Apex we need to write code efficiently for avoiding memory issues and CPU time limit everywhere, I need to understand how to iterate over a map ...
4
votes
2answers
82 views

Prevent process builders from evaluating

In a current implementation, I am running into performance issues, the issues happen because there are a lot of process builders on several objects. I am creating multiple records at the same time, ...