Jump to content

Witch is Faster?


Monkuar

Recommended Posts

Try profiling it and find out!

 

Either way, I would guess the first would be quicker. But as they say, premature optimization is the root of all evil! Choose whatever is the easiest to read, I have a huge feeling that there will be bigger bottlenecks in your code than either of these.

Link to comment
https://forums.phpfreaks.com/topic/165970-witch-is-faster/#findComment-875355
Share on other sites

Quicker? You won't see a difference until you put this in a loop that is processing millions of entries. And even then, compared to the other parts of your code, the time it takes to process this is negligible.

 

But, I would go with the first because it uses 1 variable vs 4, and is cleaner code.

 

But then again, I would probably be using Smarty for my templates, which has an alternate method in it, so I wouldn't have this code at all :)

Link to comment
https://forums.phpfreaks.com/topic/165970-witch-is-faster/#findComment-875361
Share on other sites

Quicker? You won't see a difference until you put this in a loop that is processing millions of entries. And even then, compared to the other parts of your code, the time it takes to process this is negligible.

 

But, I would go with the first because it uses 1 variable vs 4, and is cleaner code.

 

But then again, I would probably be using Smarty for my templates, which has an alternate method in it, so I wouldn't have this code at all :)

 

Smarty?

 

Im not trying to be mean ahah sorry

Link to comment
https://forums.phpfreaks.com/topic/165970-witch-is-faster/#findComment-875362
Share on other sites

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.