As any other rich UI library, PrimeFaces requires various js and css resources to create good looking and functional web applications. Downside of this requirement was the page load times as a complex page can require around 10-15 maybe more resources each causing an http request that slows down page load time. For PrimeFaces 3.0.M4, we have decided to improve this by merging commonly used resources so we now have primefaces.css and primefaces.js created at build time plus jquery.js that almost all PrimeFaces components require. The content of these files are compressed by PrimeFaces and if you enable gzip compression sizes at this time of writing are;
primefaces.css = 6.7kb
primefaces.js = 29kb
These files contain resources for around 40 commonly used components like datatable, form components, menus, trees and much more. As in production mode, JSF enables caching on these resources, resource loading really gets optimized.
We’ve tested performance difference before and after this change, for complex pages that require several components, difference is huge. Following test is from a layout sample of showcase;
2 seconds to 0.8 seconds for a not so complex page, considering production apps using many components that can be far more complex than showcase samples, difference will be bigger.
PrimeFaces is designed to be a lightweight library, one jar, no config, no dependencies, runs fast (test on showcase) and with this change PrimeFaces is more lightweight than ever!