[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Re: [PATCH] binary or instead of logical in timer sync



Keir Fraser <Keir.Fraser@xxxxxxxxxxxx> writes:

[...]
> The only reason for using binary operators in those predicates is to
> avoid extra branches in the generated code which would probably be
> generated to follow the short-circuiting semantics of the logical
> operators. In fact, I think a smart optimising compiler would generate
> the *same* object code regardless of whether we use binary/logical or
> (but I don't believe gcc is that smart yet!).

Manual optimizations like use of bitwise rather than logical
operations may speed up the program (depending on how dumb or confused
the optimizer is), but they certainly slow down the poor maintenance
programmer.  Bit-wise where I expect logical makes me hesistate and
check, because it's an unusual pattern, and in my experience often
wrong.

As with all optimizations that uglify the code, use it only when you
*know* it actually optimizes something worth optimizing.  Knowing
requires measuring.

Okay, I'll step off my soapbox now.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.