CFC Component Instantiation overhead and dependencies
This works well for the main application where performance is the critical measure, however it is not very flexible when it comes to creating an admin application that used the same core libraries but where having each component cached in the application is wasteful of resource.
I'm currently exploring to see if it's possible to get the best of both worlds:
- Runtime dependency handling (guaranteeing that components dependencies are available)
- Caching components to ensure we don't have the overhead of instantiating them multiple times.
To discover the what the overhead of instantiating a component is I ran the following tests.
| Large component (45 functions) | T1 | T2 | T3 | Average |
|---|---|---|---|---|
| Create component each time | 17438 | 11766 | 12010 | 13738 |
| Re use component | 6952 | 7240 | 8440 | 7544 |
| Small component (1 functions) | T1 | T2 | T3 | Average | Create component each time | 9059 | 9557 | 8644 | 9087 |
| Re use component | 5950 | 7238 | 5873 | 6354 |
What do these numbers mean?
For a large component up to 45% of the time was spent creating instances
For the small component 30% of the time was spent creating instances
What this shows is that it is definitely worth minimising component instantiation in performance critical applications, as between 30 - 45% of time could be spend instantiating the component (if it not reused).
Stay tuned for a solution to instantiating and caching components.




http://www.pctools.com/forum/member.php?u=48688
http://www.plime.com/l/51032/1/