Duff's device In computer science, Duff's device is an optimized implementation of a serial copy that uses a technique widely applied in assembly language for loop unwinding. Duff's device deals with serial copying, rather than just any old problem, but is a classic example of how optimisations can be made by reducing the number of times that a comparison needs to be done in a loop. Duff's device is all about omitting most of the continuation checks, so it needs to be possible to predict how the continuation check behaves.
Probably, as long as dim is a power of 2 or you have fast modulus on your target system. Learned something new today. Can I use Duff's Device on an array in C? - Stack Overflow I would like to know what PorterDuff.Mode means in android graphics.
kj duff 247, I know that it is a transfer mode. I also know, that it has attributes such as DST_IN, Multiply etc. Implementations of Duff's Device in particular lend themselves well to the equivalent machine code or IL because each block of instructions will often be the same length without needing the addition of nop fillers. †Duff's Device comes up here again, as a reasonable exception. This Duff's device implementation has a bug that makes it extremely slow: count is type int so the % must perform a real division/modulo operation.
kj duff 247, Make count unsigned (or better yet, always use size_t for counts/indices) and the problem goes away. it looks like you have mixed dtypes in your columns, I suggest first trying to coerce all values to numeric so df1['col1'] = df1['col1'].astype(int) this may fail which means you have some str values which cannot be expressed as int, so next try df1['col1'] = pd.to_numeric(df1['col1'], errors='coerce') which will force the duff values to NaN ...