Jump to content

Is it bad (on performance) to pass objects as opposed to printing them


HGeneAnthony

Recommended Posts

When I write classes I try to make them modular.  One thing I like to do is create functions that can be used to grab the data rather than having the classes print the data off itself.  This keeps things clean and easier to maintain, makes the code easier to reuse, plus it makes it easier for me to modify the form to change how the output will be displayed later.  For example, if I have a list of items to return to the form, rather than having the class print out to the form, I would create functions the form can easily parse to return specific pieces the data.  The code on the form is very clean as well as the classes code.  The problem is I store the results in a collection until the form grabs it and I was wondering how is this on performance.  In a typical desktop app this would be the logical thing to do but with a web server where performance can be hit hard I don't know.  Is printing the data off immediately much better on performance.

I would only ask this question and want the answer to this question if I am in a situation where my perfomace is INDEED noticably suffering

 

you seem to be in the ....hmmm what if phase, not the "damn my perfomance sucks, what do I do stage?"

 

hence i wouldn't worry about this so much until you do notice it, and if you have never noticed it, well there is your answer :)

 

(dont' get me wrong asking question are great, but you asked for my opinion-walla)

In the past I've written php scripts for small companies.  The speed has been pretty good since I don't over do it with heavy graphics.  My sites are built for performance and navigation rather than an expression of art.  What I'm worried about is when I get heavy traffic how it can be affected. 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.