serge-sans-paille / pythran

Ahead of Time compiler for numeric kernels
https://pythran.readthedocs.io
BSD 3-Clause "New" or "Revised" License
2k stars 193 forks source link

Slow bitwise operators #569

Open serge-sans-paille opened 8 years ago

serge-sans-paille commented 8 years ago

Expressions like

#pythran export foo(uint8[], uint8)
def foo(a, b):
    return a & b == a

are slow in pythran if a.dtype is np.uint8. It's no longer the case for uint64, so I guess we should introduce a representation change when all operations are bitwise.

LuisBL commented 8 years ago

arggg, I've do many bitwise operations on uint8. Say me if there is something I can do to help.

LuisBL commented 7 years ago

Did you have a chance to improve speed for np.uint8 & np.uint8 ?

serge-sans-paille commented 7 years ago

On Sat, Jan 07, 2017 at 07:48:24AM -0800, Luis wrote:

Did you have a chance to improve speed for np.uint8 & np.uint8 ?

No, but thanks to your reminder, that will be my next task! Keep in touch :-)

serge-sans-paille commented 7 years ago

@LuisBL just to be sure : any reason why not nusing a uint64 ?

LuisBL commented 7 years ago

yes it's because I use numpy.unpackbits to store 8 0/1 in only one byte.

Cf. numpy.bitwise_and and numpy.unpackbits

serge-sans-paille commented 7 years ago

I've got the fix but SIMD instructions are not used for comparison operators, I'll push it soon.