This content has been marked as final. Show 3 replies
Well yes, all you did was move your query into a CFC that must be
initiated for every user in your display. So you are still doing each
and every query you where doing before, and on top of that you are
creating an object around it. This is not going to improve performance
in any way.
I'm probably not the one to help you improve this with OOD. I'm not
that good at it myself. I'm still struggling with beans, DAOs,
gateways, factories, and MVP designs and how you put them all together
But at the most basic level, what you want to remove is the individual
queries run sequentially, whether you use procedural or OOP logic.
Ideally you would run one query that gets all the data for all the users
you need to know about in one swoop and save this as long as you need
it, so you don't have to do it again unnecessarily.
Thanks for your response. I understand I am doing the same thing, essentially, but what I don't understand is why there is such a significant processing time difference between the two.
True enough, I should just run one query to get what I want... that would improve performance overall...
I don't understand is why there is such a significant processing time
difference between the two.
Because CREATING a new instance of an object is very expensive, and you
are doing this over and over once for each user displayed. The savings
comes from designs where you can minimize and optimize when and how
often you do this. Ideally you create an instance of an object once,
usually at the beginning or some other convenient point in the logic
flow, then use this instance over and over again, for as long as you can.
Using initiated CFC objects is very efficient! Creating them - not so much.