Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Performance...

Status
Not open for further replies.

Programmer76

Programmer
Jul 25, 2006
35
CA
Hi,

Does anyone know how I can figure out the performace draw backs of the number of paramerters you send to a function I have created?

For example I would like to make a funtion that takes 4 parameters. The parameters will contain the following:

1. Approx 15 characters
2. Maybe 75 characters
3. Approx 40
4. 1 character

Can anyone shed some light this? I am wondering if this not very efficiant.

Interested in any suggestions or links to articles...


CES
 
i've written functions that take pages worth of data and manipulates it and it still not take long at all. I think from what your asking, i guess it all depends on how fast you need it to be.

You can always find a script that will time how long the page took to load and then prints it out at the bottom of the page.

I would imagine an easy way would be just put the current time (in seconds) into a variable at the top of the page, then at the bottom of the page make another variable with the time in seconds. Then just subtract the 1st one from the second one and print the result.
 
If I remember correctly, parameters passed to a PHP function are memory addresses of the data the function will handle. The memory address for a string 100 characters long is the same as for a string 1 character long. If you've worked with C or C++, think of them as pointers that the function automatically dereferences.

Lee
 
Thanks for the opinions!

In reagrds to the pointer thing...this is sort of what I was thinking...I had made the function take the string parameters by ref (just t use the pointer)...

function myFunction(&$myRef){
//STUFF
}

just to make sure though when I call the function do not use the variable right...

myFunction($param);


CES
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top