How can I improve performance on the initial page load?

Components, Ajax Framework, Utilities and More.
User avatar
optimus.prime
Prime
Posts: 17328
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

18 Dec 2012, 00:36

Note: Charts ans Schedule are not aggregated in primefaces.js and primefaces.css.

javaone9
Posts: 306
Joined: 06 Nov 2012, 20:50

18 Dec 2012, 01:55

optimus.prime wrote:Note: Charts ans Schedule are not aggregated in primefaces.js and primefaces.css.
Right. But if they are included in JSF tree, but not rendered, these .js will still be included in generated HTML. I think non-core component resouces(not in primefaces.js/.css) should be included only when their encode() methods are called. Especially for home page that requires fast loading. Charts/schedule components will be shown in ajax way when user click some buttons, and the same JSF page is used. At this point, chart.js/schedule.js need to be included.
Responsive Webapp Framework: Cmobilecom WAF 5.6
JSF components: PrimeFaces 5.0
JSF core: Mojarra 2.2.6
Glassfish 4, Tomcat 8
FireFox 28, IE 8, Chrome 24.0

User avatar
optimus.prime
Prime
Posts: 17328
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

18 Dec 2012, 10:12

JSF handles resource management not PrimeFaces and it is quite tricky to implement what you ask for. If you add these components on the fly like in a conditional ui include PF will load them on the fly though using dynamic resource loading feature of ours.

User avatar
Oleg
Expert Member
Posts: 3788
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

18 Dec 2012, 11:44

Yes, conditional "src" in ui:include is a good approach. In general, dynamic resource inclusion is possible in JSF. We did this e.g. for CKEditor in PF Extensions. But in a common case it is also fine with standard JSF res. management. Static resource loading doesn't hirt for small resources. Dynamic approach makes sense for more or less big resources. CKEditor has e.g. MBs of resources and it makes sense don't load all them at once. Only on demand, if you change theme or similar.

How big are Chart and Schedule resources? I think the size is ok. Is it not?

User avatar
optimus.prime
Prime
Posts: 17328
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

18 Dec 2012, 11:57

How big are Chart and Schedule resources? I think the size is ok. Is it not?
charts.js is 76kb, schedule.js is 20kb in showcase. Both are not in primefaces.js (40kb with 35+ most used components).

User avatar
Oleg
Expert Member
Posts: 3788
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

18 Dec 2012, 12:55

The size of these resources is quite ok for me. I can not see any reason to come up with some workarounds or implement tricky dynamic loading based on "rendered" attr. or whatever. It is not worth in my opinion.

javaone9
Posts: 306
Joined: 06 Nov 2012, 20:50

19 Dec 2012, 03:39

I am not sure how difficult it is to implement dynamic loading of resources. Some thoughts:

Take chart for instance,
1. use @vewScope variable to remember whether chart.js is included in the tree.
2. when a chart component is encoded, check the variable, add chart.js if not added yet.
So chart.js will be added before it is used by any chart component.
not necessary to add it in the head, just add it where the component is rendered.
This works for both ajax and non-ajax requests.
After chart.js is added, make sure it will not be removed by any subsequent ajax update.
3. if this simple approach works, it worths the effort to implement it.

Thanks,
Dave
Responsive Webapp Framework: Cmobilecom WAF 5.6
JSF components: PrimeFaces 5.0
JSF core: Mojarra 2.2.6
Glassfish 4, Tomcat 8
FireFox 28, IE 8, Chrome 24.0

User avatar
sebargarcia
Posts: 44
Joined: 01 Apr 2011, 00:24
Location: Salta, Argentina

20 Dec 2012, 23:26

Here is a good aproach how to Speed up Primefaces page load with p:remoteCommand partial update see
http://kahimyang.info/kauswagan/howto_b ... ial_update
Netbeans 8.0, Mojarra 2.1.26 , Primefaces 5, PrimeFaces Extensions 2.0.0, OmniFaces 1.8.1 , Glassfish 3.1.2.

MagmaRules
Posts: 1
Joined: 30 Jan 2013, 01:58

30 Jan 2013, 02:15

optimus.prime wrote:JSF handles resource management not PrimeFaces and it is quite tricky to implement what you ask for. If you add these components on the fly like in a conditional ui include PF will load them on the fly though using dynamic resource loading feature of ours.
I understand it might be hard but is there any plan to split javascript loading by component?

PrimeFaces PRO
Posts: 41
Joined: 27 Jan 2013, 23:44

31 Jan 2013, 00:07

With PrimeFaces PRO, it's easy to support, tune and add features to PrimeFaces as if it were an in-house framework.

PrimeFaces PRO is a term based commercial support service. With the exclusive services of Pro account, you no longer need to post your questions in PrimeFaces community forum and your issues to community issue tracker.

Standard PRO Services

Access to pro.primefaces.org
Response at most in 1 business day.
Defect patches.
Private branch management in case you need.
Customized builds.
Unlimited number of cases.
Remote desktop connection.
Conference calls for discussions.
High priority to your issues.
Non PrimeFaces related general JSF assistance.

New Features

New feature and enhancement requests are not available in core services and provided via an hour based model instead. When you have a feature request we provide an estimate, if you confirm we deliver your request within an estimated timeframe and deduct the amount of work from your hours. These requests can be;

- New components.
- New functionality to existing components.
- Changing the way a certain functionality is implemented.
- Proof of Concept implementations of a use case.
- Code reviews to offer best practices.

Hourly rate is 200 usd and discounts apply on bulk purchases that are more than 50. You can purchase additional hours along with the subscription and also anytime during your subscription period. If your subscription term ends with unused hours, they will be added to your new subscription term in case you extend.

To get a quote, please contact us and mention the total number of developers who will be working in your PrimeFaces projects.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: Bing [Bot], Google [Bot] and 10 guests