Questions tagged [performance]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
22
votes
3answers
2k 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 ...
12
votes
1answer
349 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 ...
6
votes
1answer
6k views

How to implement on scroll action in lightning to show next few list of records

I want to render many(about 1000) components and I am displaying them through aura:iteration in another aura:iteration. This is causing me performance issues. I want to display only 10 records at an ...
17
votes
1answer
1k views

Dramatic increase in AsyncApexJob latency

Problem Salesforce is a multi-tenant platform and as a consequence the time for an asynchronous request to be dequeued may vary. This is not a problem for us, as long as the delays stay within ...
36
votes
2answers
2k views

Why Would I Not Enable Chaining?

The Apex Design Patterns is an awesome resource, and I learned many tricks from it. One of my favorites is method chaining, and I quickly developed an axiom: Any time you would return void, return ...
15
votes
4answers
6k views

How to avoid instantiating object inside a loop?

There are many scenarios where I have to create records of polymorphic objects using apex. For e.g. creating a Task record or a CustomObject__c record for each Case created. In general I do something ...
19
votes
2answers
2k views

Dealing with auto-batching of triggers

I've recently been trying to come to terms with the oddities of the auto-"batching" of triggers. What I'm referring to is how when dealing with more than 200 records in a trigger execution, ...
12
votes
1answer
3k views

Lightning Components: why are subsequent invocations of $A.enqueueAction() so super SLOW?

I have an Lightning Component with an controller containing a sever side APEX-action like this @AuraEnabled public static Object myServerSideAction_1() { return null; } @AuraEnabled public static ...
13
votes
3answers
4k views

Advice on speeding up Visualforce pages?

I have a fairly complex Visualforce page that displays about 10 fields from about 10 different custom object types including a couple of tables, making about 20 objects overall in total (i.e. 200 ...
14
votes
1answer
596 views

Lightning Components: Why is the rendering of 3-level nested <aura:iteration>'s so slow?

I have been working with a nested iteration and it is causing a delay of >3 seconds AFTER loading things from the APEX controller. The APEX response itself is fast, so I'm not looking for any APEX ...
18
votes
4answers
13k views

Efficiency of List.size() > 0 vs. !List.isEmpty()

Anyone have any data to support a claim for which of the following two expressions is more efficient (meaning faster)? The use case is determining whether a List is empty to inform an auxiliary method ...
9
votes
2answers
4k views

What is the Function of aura:dependency?

I came across something that vastly improved the performance of the Lightning application that I am building. However, I am not sure exactly why. When my application initializes, I am calling a doInit ...
12
votes
3answers
378 views

Metadata+ToolingAPI access on CS14 (and other pods) extremly slow & No Support?

We are working on CS14. Starting last Friday we are suffering form a extreme performance loss on CS14. Loading and Saving Metadata via Tooling/Metadata-API is very slow. Operations which usually ...
7
votes
1answer
222 views

Syntactic vs Performance difference on object creation?

Is there any performance difference between: Contact con = new Contact(); con.Id = conId; con.AccountRoles__c = newRole; ... and... Contact con = new Contact( Id = conId, ...
5
votes
2answers
222 views

EU5 not usable for development: Metadata-API deployment on EU5 unresponsive

Today I encounter a severe performance degradation on Metadata-API deployment speed on EU5. I'm waiting > 950 seconds (sometimes > 1500 seconds), when it usually deploys in < 25 seconds... This is ...
2
votes
3answers
10k views

Nested SOQL query?

so, the following query is pretty self explanatory: SELECT p.Accountid, p.Name, (select name FROM Account where id = p.Accountid) FROM Contact p order by accountid' is there any way to do this in a ...
8
votes
1answer
178 views

Most efficient way to switch on SObjectType?

It is a bit odd we can't evaluate a switch statement directly on SObjectType, so I am trying to determine conclusively which workaround is the most efficient. Just to verify, I tried to compile this ...
8
votes
0answers
271 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 ...
7
votes
1answer
88 views

Ramifications Of Cross-Object Reference Just For Id?

The Problem I see this pattern often and it drives me crazy: Id accountId = someOpportunity.Account.Id; // just reference AccountId! OR List<MyObject__c> records = [SELECT ... FROM ...
6
votes
7answers
6k views

Deployment with Force.com IDE Taking Forever

We're experiencing extremely long deployment times even when deploying single classes using the force.com IDE plugin to eclipse. The deployment takes up to 1 hour yet running all unit tests from the ...
6
votes
2answers
1k views

Only query Id field in start() to speed up Apex Batch

I am looking for ways to speed up a complex Batch job which takes days to run in a specific customer org. This Batch is snapshoting records of arbitrary objects into denormalized (as a single records ...
5
votes
1answer
952 views

RemoteAction Vs REST? Which is faster?

I need to get the results really fast on my page. I have to decide between 2 approach. Build a HTTP get service, by using a VisualForce page as Service. Using contentType as 'application/JSON'. Use ...
5
votes
1answer
837 views

Anyone else having issues with deployment to sandbox stuck in pending for 5-60 minutes

Developing in two sandboxes and both of them when I attempt to deploy anything via metadata or tooling API the deployment is stuck in a pending status from 5-60+ minutes. I have a case open for one ...
4
votes
1answer
248 views

Formulas in workflows & validation - lazy or eager evaluated?

I tried to run some tests in developer edition and didn't see great difference so I am not sure. Basically I have a case that CPU time is leaking somewhere and I suspect it's validation rules or ...
17
votes
3answers
3k views

Are sandboxes slower than production Orgs?

I've noticed quite often that sandbox instances are showing a slower performance during Metadata API and Tooling API access. Today this happened on cs14. The force.com IDE froze completely during a "...
34
votes
2answers
6k views

When To Use Set vs. List In SOQL

I have always assumed that it is better to use a Set in my query filters instead of a List. For example: Set<Id> parentIds = generateParentIds(); List<Child__c> children = [SELECT Id FROM ...
18
votes
2answers
2k views

How to efficiently profile Visualforce components and their controllers?

I have a quite complex Visualforce component (edit grid) that is running to slow (2-4 seconds to display) When I say complex I mean: The Component itself is calling other components Many thousand ...
21
votes
2answers
7k views

What are the implications of implementing Database.Stateful?

I've recently implemented a batch apex class that initially did not implement Database.Stateful. After using it for a while as-is I decided to implemente better error handling via a simple Map to ...
25
votes
3answers
3k views

Writing too much to debug log would affect APEX trigger or Visualforce page performance?

In order to debug we usually write chunks of data to the debug log using System.debug statements. Will writing too many debug logs affect visualforce page or Apex performance in any way?
11
votes
3answers
921 views

Measuring performance of batch apex query

Is there a good way to tell how long the query in a batch apex job is taking? I don't find anything in the debug logs. I can see each batch and how long it takes, but not how long the initial query ...
17
votes
2answers
440 views

Visualforce PageReference - Name Constructor vs. Factory

For a developer who wants to use a PageReference to redirect to a Visualforce Page, are there any notable differences between constructing it by name versus using the Page.PageName factory method? By ...
11
votes
1answer
1k views

What's In A Hash Collision?

When I have used Custom Types in Map Keys and Sets, I generally follow a similar pattern listed in the Apex Developer Guide: public Integer hashCode() { return (31 * x) ^ y; } Someone asked ...
8
votes
1answer
651 views

Most optimal way to Enforce CRUD/FLS in Apex

This article shows a common way to check access in Apex with a syntax like: if (!Schema.sObjectType.Contact.fields.Name.isAccessible()){ return ''; } However, it is very time/space-consuming to ...
8
votes
1answer
811 views

Expense of using System.debug

I've seen code on an inherited project output debug info while iterating large collections of objects. System.debug(Logginglevel.DEBUG, 'sQuery=' + sQuery); If the system logging level is set ...
8
votes
3answers
8k views

Contacts without Accounts: Is it possible, and if not, why?

Context: My understanding is that historically Salesforce was built to manage Business-to-Business (B2B) contacts, and the idea that the data model would not be built for contacts without accounts ...
7
votes
1answer
2k views

Suggestion to avoid for loop inside a for loop

I'm starting out new in APEX. I created below method to call inside a trigger. I know my code below is not efficient calling loop inside a loop to avoid SOQL. I looked online for a day before posting ...
6
votes
2answers
852 views

Best practises for speeding up Apex Batch class

My previous question about slow Batches probably was to focused on a specific problem, so I try it again much broader. What are general rules of thumb to make a slow Batch faster? Although I added 2 ...
1
vote
1answer
337 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) ...
0
votes
0answers
315 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 ...
14
votes
2answers
7k views

Performance: List.get(index) vs List[index]

I want to know which approach is better in Salesforce when getting element from list. Is this faster? myList.get(0); Or is this faster? myList[0]; Using large list which above statement is more ...
7
votes
2answers
629 views

How to efficiently determine the `name` field of an sobject for dynamic query?

Is there a more efficient way to determine the name field of an sobject other than iterating through all the fields obtained via DescribeSOBjectResult? Often, the name field is simply Name but in ...
5
votes
1answer
988 views

considerations re: performance and servlet.integration?

I'm assuming that servlet.integration represents the loading and launching of an apex program (VF, Controllers and all) into a java servlet runner. It appears to take a long time for the first apex ...
5
votes
0answers
74 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 ...
4
votes
1answer
111 views

Speedup Testing with Force.com IDE using slim Logs - but how to set the log-level?

A lot has been written here about slow development in general and slow testing in particular e. g.: Slow development Faster unit tests? For my use case I found one reason for slow testing while ...
3
votes
2answers
1k views

Track number of API calls for an application

I'm working on an application, which uses SOAP, REST and Bulk API to integrate with Salesforce. Is there any API call in Salesforce which enables me to track how much API calls did I consume in a ...
2
votes
4answers
2k views

SOAP API - getUpdated()/retrieve() vs query()/queryMore()

The Salesforce SOAP API's getUpdated() is designed to return all objects of a given type, inserted or updated within a given timeframe. IDs for updated records will then be returned and the Salesforce ...
1
vote
1answer
86 views

Capturing Lightning Performance (Page Load Time) without any special tools?

I have been requested to come up with a report or analysis that could "show performance of the page load for a certain period of time or something similar" Business problem: Some customers currently ...
1
vote
2answers
3k views

SObject Numeric field - Integer.valueOf() vs casting

When working in Apex it is not uncommon for us to work with a numeric field that has a 0 scale. To use that with some built in functions we need to use an Integer. To provide an example, let's say we ...
0
votes
2answers
53 views

Can any one please tell me which one is the optimized code for preventing duplicate accounts to be inserted or updated

Which one of the following triggers are optimized for preventing duplicate accounts? trigger AccountDuplicateTrigger on Account (before insert,before update) { List<Account> ...