Page 2 of 2

Re: help please

Posted: Wed Sep 16, 2009 11:50 am
by superdezign
Being an interpreted language, bitwise operations shouldn't have much of an advantage in PHP.

Re: help please

Posted: Wed Sep 16, 2009 12:19 pm
by jackpf
margaaa 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 :)
Oh right...that's fair enough I guess. You have my apologies. But go to class next time :P
Mirge wrote:Hope you're prepared to explain the code if you have to then lol
What do you mean? You want to know how the code I posted works?
ricehigh wrote:I found that bitwise comparison was sligtly faster than modulo operations
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...
superdezign wrote:Being an interpreted language, bitwise operations shouldn't have much of an advantage in PHP.
Sorry for my ignorance...but how would that make a difference? :)

Re: help please

Posted: Wed Sep 16, 2009 12:22 pm
by superdezign
jackpf wrote:
superdezign wrote:Being an interpreted language, bitwise operations shouldn't have much of an advantage in PHP.
Sorry for my ignorance...but how would that make a difference? :)
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.

Re: help please

Posted: Wed Sep 16, 2009 12:26 pm
by Mirge
jackpf wrote:
Mirge wrote:Hope you're prepared to explain the code if you have to then lol
What do you mean? You want to know how the code I posted works?
Was referring to OP lol

I didn't see you post any code in this thread?

Re: help please

Posted: Wed Sep 16, 2009 12:39 pm
by jackpf
superdezign wrote:
jackpf wrote:
superdezign wrote:Being an interpreted language, bitwise operations shouldn't have much of an advantage in PHP.
Sorry for my ignorance...but how would that make a difference? :)
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.
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?
Mirge wrote:
jackpf wrote:
Mirge wrote:Was referring to OP lol

I didn't see you post any code in this thread?
Ha. Yeah, that makes more sense :P

And the code I posted two posts above your last!!!

Re: help please

Posted: Wed Sep 16, 2009 12:43 pm
by superdezign
jackpf 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?
Surely. Just marginally. :3

Then again, I don't know how the interpreter works. For all we know, it chokes on the ampersand token. :p

Re: help please

Posted: Wed Sep 16, 2009 12:46 pm
by Mirge
jackpf wrote:And the code I posted two posts above your last!!!
Oh lol I was looking for code that was written for the OP

Re: help please

Posted: Wed Sep 16, 2009 1:02 pm
by margaaa
Mirge wrote:Hope you're prepared to explain the code if you have to then lol
im not, but i will do my best to understand it! :)

Re: help please

Posted: Thu Sep 17, 2009 7:29 pm
by peterjwest
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.

Re: help please

Posted: Fri Sep 18, 2009 4:30 am
by jackpf
Yeah, it'll make virtually no difference. Still, it's interesting to see which is faster :D