Assembly optimizations for python (sorry! Didn’t check source)

Little afraid because of some people but

On the apple arm64 documentations it mentions you can call assembly code from c, which can translate to python calls from scripting,

So we can do a macro that allows stuff like optimization of code with stuff like that ifdef thing

And yeah, I grow weed in ca yeah, cops :frowning:

So we can do

Extern bitshift(uint64 r1, uint8 r2); /* heavy optimization */

And a function macro or header guard that allow you to select per processor for portability

Again, we’re not looking for 20kb asm code, were looking for small assembly code that we can call from the python source and possible modules

Ty!!

I would suggest you look into the source code. If you find locations where inline asm will speed up the interpreter performance significantly, it might be possible to add.

Note that the specific example you listed will not fly for various reasons:

  • bitshift is already a native operator in C, it will be practically impossible to write faster assembly thsn what the C compiler already does
  • python’s ints are bigint, not limited to 64bit. Therefore the logic required is quite a bit more than the simple signature you showed would imply.