help please
Moderator: General Moderators
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: help please
Being an interpreted language, bitwise operations shouldn't have much of an advantage in PHP.
Re: help please
Oh right...that's fair enough I guess. You have my apologies. But go to class next timemargaaa wrote:lol no! my course was (or is) audiovisual and multimedia. but what i really want is audiovisual, but this discipline was obligatory, and i couldn´t go to the classes.
thank you soooo much
What do you mean? You want to know how the code I posted works?Mirge wrote:Hope you're prepared to explain the code if you have to then lol
How weird, my results were the other way around. But yeah, I guess since there's such a tiny margin, it can go either way...ricehigh wrote:I found that bitwise comparison was sligtly faster than modulo operations
Sorry for my ignorance...but how would that make a difference?superdezign wrote:Being an interpreted language, bitwise operations shouldn't have much of an advantage in PHP.
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: help please
That's the point. It shouldn't. I'm not saying that bitwise operations are at a disadvantage, just that they are not at an advantage. All operations are still at the mercy of the interpreter.jackpf wrote:Sorry for my ignorance...but how would that make a difference?superdezign wrote:Being an interpreted language, bitwise operations shouldn't have much of an advantage in PHP.
Re: help please
Was referring to OP loljackpf wrote:What do you mean? You want to know how the code I posted works?Mirge wrote:Hope you're prepared to explain the code if you have to then lol
I didn't see you post any code in this thread?
Re: help please
Ahh I get you now. But surely PHP has to perform these operations in C? So...whatever's faster in C would be faster in PHP surely?superdezign wrote:That's the point. It shouldn't. I'm not saying that bitwise operations are at a disadvantage, just that they are not at an advantage. All operations are still at the mercy of the interpreter.jackpf wrote:Sorry for my ignorance...but how would that make a difference? :)superdezign wrote:Being an interpreted language, bitwise operations shouldn't have much of an advantage in PHP.
Ha. Yeah, that makes more sense :PMirge wrote:jackpf wrote:Mirge wrote:Was referring to OP lol
I didn't see you post any code in this thread?
And the code I posted two posts above your last!!!
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: help please
Surely. Just marginally. :3jackpf wrote:Ahh I get you now. But surely PHP has to perform these operations in C? So...whatever's faster in C would be faster in PHP surely?
Then again, I don't know how the interpreter works. For all we know, it chokes on the ampersand token. :p
Re: help please
Oh lol I was looking for code that was written for the OPjackpf wrote:And the code I posted two posts above your last!!!
Re: help please
im not, but i will do my best to understand it!Mirge wrote:Hope you're prepared to explain the code if you have to then lol
-
peterjwest
- Forum Commoner
- Posts: 63
- Joined: Tue Aug 04, 2009 1:06 pm
Re: help please
With small to medium performance differences, you'll usually be better choosing the more readable/understandable option. Most PHP programmers aren't too practiced with bitwise operations, so modulus would be clearer.
Also you really shouldn't be optimising arbitrarily. Use a profiler and optimise whatever takes the most time. Bitwise or modulus operations are unlikely to be the bottleneck.
Also you really shouldn't be optimising arbitrarily. Use a profiler and optimise whatever takes the most time. Bitwise or modulus operations are unlikely to be the bottleneck.
Re: help please
Yeah, it'll make virtually no difference. Still, it's interesting to see which is faster 