writing python extensions in assembly

Dan Upton upton at virginia.edu
Fri May 16 13:44:32 EDT 2008


>> 3.  If it is still slow, embed some assembler where it is slowing down.
>>
>
> I won't know if the assembler is faster until I embed it, and if I'm going
> to do that I might as well use it.
> Although it's true I'd only have to embed it for one system to see (more or
> less).
>

Regardless of whether it's faster, I thought you indicated that really
it's most important that it's fast enough.

That said, it's not true that you won't know if it's faster until you
embed it--that's what unit testing would be for.  Write your loop(s)
in Python, C, ASM, <insert language here> and run them, on actual
inputs (or synthetic, if necessary, I suppose).  That's how you'll be
able to tell whether it's even worth the effort to get the assembly
callable from Python.

On Fri, May 16, 2008 at 1:27 PM, Mensanator <mensanator at aol.com> wrote:
>
> Why wouldn't the compilers support it? It's part of the x86
> architexture,
> isn't it?

Yeah, but I don't know if it uses it by default, and my guess is it
depends on how the compiler back end goes about optimizing the code
for whether it will see data access/computation patterns amenable to
SIMD.



More information about the Python-list mailing list