Speed Issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Jeremy
Forum Newbie
Posts: 3
Joined: Fri Aug 20, 2004 9:45 pm
Location: Alabama, USA

Speed Issue

Post by Jeremy »

I'm trying to settle a debate about variables and referencing. We all know what referencing is used for, but now we've got an arguement that unless a variable specifically needs to be copied, that it's better to reference it, because referencing is faster.

While, I don't believe it's a good idea to operate under this programming practice, is it true that referencing is faster than copying?

Edit: Even if it is faster, it's probably a very marginal difference, but I'm still curious. My own personal tests show that referencing is slower, but I'd like a second opinion.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

that speed is extremely machine dependant. Some machines can copy data very quickly.. the amount of data that needs to be copied also must be taken into account.

You can test the performance fairly easily though.. ;)
Post Reply