Is this make sence? Dynamic assembler for python

Paul Rubin no.email at nospam.invalid
Mon Jun 21 00:37:15 EDT 2010


Steven D'Aprano <steve-REMOVE-THIS at cybersource.com.au> writes:
> Not that I don't believe you, but that is an extraordinary claim that 
> would require more evidence than just "Hey, some guy on the Internet 
> reckons his assembly code can regularly out-perform optimizing C 
> compilers" before I will change my opinion *wink*

It is really true, and it's the opposite claim that would be
extraordinary.  That's why compilers like gcc include pragmas for
assembler intrinsics for when you want include some inline assembly code
in your C program.  gzip uses it for example, as does Gnu MP and
OpenSSL.  That's why gmpy is several times faster at multi-precision
arithmetic than Python's built-in longs, that are implemented in C.

Another reason for wanting dynamic assembly code is so you can embed
staged programming in your python code.  Think of how slow python
regexps are.  Now imagine a regexp package that compiles your regexp
directly to assembly code instead of to some silly interpreted state
machine.  Parser generators like pyparsing could similarly generate asm
code directly.



More information about the Python-list mailing list