[nycphp-talk] Bitwise Operators
Flavio daCosta
nyphp at n0p.net
Wed Jun 29 10:57:36 EDT 2005
On 06/29/2005 10:04 AM, Kamm, William R (Bill), ALABS wrote:
> I don't see as much value to bit operations today as I
> did in the past.
Although I do agree that you can do everything without using bit
operations, and a few bitwise operators here and there are not going to
make your code ultra fast. I still see value in using them.
Clean Code:
In the example I demonstrated, I find it actually keeps the code simple,
clean, and easy to read. For example, If I was to track those flag
values as booleans, I would want to aggregate them all in another data
structure such as an array or object. With this comes more code and
complexity.
Speed:
Php is parsed at runtime (aside from code accelerators/caching). Even
if you have a fast processor(s), there still is alot that happens every
time a php script is requested. If you can replace arrays of options
with a few bitwise operators, it may not be much, but it's gotta do
something. ;)
Just my opinion.
Flavio
More information about the talk
mailing list