Getting the individual describes is significantly faster. Depending on your situation, it is anywhere from 14 to 850 times as fast!
Describing Many Objects Once
The first continuum I profiled is the situation where you have many objects to describe and make one call to describe all of them.
The individual getDescribe
approach can describe anywhere from 5 to 11 objects per millisecond, whereas the bulk describeSObjects
approach takes anywhere from 2 to 3.5 milliseconds per object. In this continuum, individual describes perform roughly 14 to 30 times better than the bulk describe method.
Here is the amount of CPU time consumed for each approach to describe a given number of sObjects once:
Objects | Individual | Bulk | Multiplier
================================================
5 | 1.1 | 17.5 | 15.9
10 | 1.5 | 24.6 | 16.4
15 | 2.1 | 29.7 | 14.1
20 | 2.6 | 38.7 | 14.9
25 | 2.8 | 71.4 | 25.5
30 | 3.1 | 88.7 | 28.6
35 | 3.3 | 107.7 | 32.6
40 | 4.6 | 117.2 | 25.5
45 | 4.3 | 133.4 | 31.0
50 | 4.7 | 144.3 | 30.7
55 | 5.2 | 151.4 | 29.1
60 | 5.9 | 153.7 | 26.1
65 | 6.2 | 156.5 | 25.2
70 | 6.8 | 167.3 | 24.6
75 | 7.3 | 174.7 | 23.9
80 | 7.6 | 184.7 | 24.3
85 | 7.9 | 192.4 | 24.4
90 | 9.0 | 193.0 | 21.4
95 | 8.7 | 198.1 | 22.8
100 | 9.1 | 209.7 | 23.0
Describing One Object Many Times
The second continuum I profiled is the situation where you describe one object many times, for instance if you have describes in a loop somewhere in your code.
The individual getDescribe
approach can describe an object anywhere from 17 to 33 times per second, whereas the bulk describeSObjects
approach takes anywhere from 25 to 29 milliseconds per describe. In this continuum, individual describes perform hundreds of times better than the bulk describe method.
Here is the amount of CPU time consumed for each approach to describe one object (User
) a given number of times:
Iterations | Individual | Bulk | Multiplier
====================================================
25 | 1.5 | 719.7 | 479.8
50 | 2.6 | 1408.4 | 541.7
75 | 2.9 | 2147.9 | 740.7
100 | 4.3 | 2782.4 | 647.1
125 | 4.4 | 3667.9 | 833.6
150 | 5.2 | 4171.3 | 802.2
175 | 6.1 | 4640.4 | 760.7
200 | 7.3 | 5167.1 | 707.8
225 | 7.2 | 5887.2 | 817.7
250 | 7.8 | 6618.9 | 848.6
275 | 8.7 | 7175.3 | 824.7
300 | 9.0 | 7537.6 | 837.5
325 | 9.8 | 8328.8 | 849.9
350 | 11.1 | 9090.1 | 818.9
375 | 12.9 | 9423.5 | 730.5
400 | 12.3 | 10422.8 | 847.4
425 | 13.5 | 10716.1 | 793.8
450 | 13.6 | 11431.6 | 840.6
475 | 14.5 | 12063.8 | 832.0
500 | 14.8 | 12977.7 | 876.9
It is a common assumption that the HTML to PDF engine presently used by Salesforce is Flying Saucer that only supports version 2.1 of CSS (W3C Recommendation 07 June 2011) whereas SLDS is designed to work with modern browsers only that support version 3 CSS.
So while you may be able to eventually get some parts of the SLDS markup to work, the PDF output is unlikely ever to be as you would like it to be. Including simple CSS used just for the PDF output is the simplest workaround.
Best Answer
I have been into the situation when deciding the view architecture. Here are some real figures based on various attributes used with
<apex:page>
For example consider a page like this:
Controller is a separate thing (has own processing) so, assume there is no controller in Visualforce page.
1. No attribute
A page with only html tags and no attribute added take around 50ms to load. Consider
50ms
the default loading time of page which has no attribute set explicitly.2. applyBodyTag attribute
applyBodyTag = false
attribute significantly increases the page loading time as now its browser or the developer's work to apply body tag properly. In comparison to50ms
it takes around35ms
.3. applyHtmlTag and showHeader attribute
This faster than
applyBodyTag = false
as no header needs to be rendered by Visualforce engine. In comparison to last35ms
it takes9ms
to load a page.4. applyBodyTag and applyHtmlTag and showHeader attribute
It reduces visualforce engine processing a little. In comparison to
9ms
it takes7ms
.5. docType HTML-5.0
This is true
HTML-5.0
is faster and in comparison to default (#6) it takes30ms
.6. docType default
It is slower than #5. Figure at "#1 No attribute" is similar to this
50ms-58ms
.7. showHeader attribute
It is faster than
showHeader = true
.8. sidebar attribute
When showHeader is false, sidebar automatically is false. It is faster the true values set.
9 showHeader and sidebar attribute
This is slower than showHeader and sidebar =
false
.10. standardStylesheets attribute
This attribute does not make significant difference, but value = false is faster. Time will be reduces to few ms like if page take
35ms
to load wit will take32ms
when set to false.12. showHeader and sidebar attribute but no standardStylesheets
It is same as #10.
Also, longer the html text longer the processing time. More apex tags more processing time. Action functions, Action support, Remoting function and re-render increases page processing time a lot.