dream hardware

castironpi at gmail.com castironpi at gmail.com
Wed Feb 13 21:41:05 CET 2008


On Feb 13, 2:23 pm, castiro... at gmail.com wrote:
> On Feb 13, 2:01 pm, Laurent Pointal <laurent.poin... at laposte.net>
> wrote:
>
> > Le Tue, 12 Feb 2008 10:05:59 -0800, castironpi a écrit :
>
> > > What is dream hardware for the Python interpreter?
>
> > Dream... I dont know, but hardware for the Python interpreter, yes.
>
> >http://www.telit.co.it/product.asp?productId=96
>
> > --
> > Laurent POINTAL - laurent.poin... at laposte.net
>
> Maybe something with hardware string hashing, plus maybe other
> primitives.

sum= 0
for x in xrange(10000):
    sum+= x

takes the sum of 0..9999.  The formula, of course, is (9999*10000)/2.
The assembly "is":

0: seti r0 0     #r0= 0
1: seti r1 10000 #r1= 10000 (count backwards)
2: seti r2 -1    #r2= -1
3: seti r3 4     #r3= instruction #4
4: add r1 r0     #add= r1+ r0
5: set add r0    #r0= add
6: add r1 r2     #add= r1+ r2 (r1 - 1)
7: set add r1    #r1= add (r1 - 1)
8: cjmpnz r1 r3  #jump to #4 (r3) if r1 <> 0

The Python equivalent is, to say the least, more complicated.
Retrieve the iterator value from the heap, maybe cache, the integer
values from the heap (!), also maybe, iterator increment method, and
writes to instance table properties, which may or may not involve a
string hash and hash lookup every time.  Stack control clearly isn't
anything simple, either, with inspect and all (right?).  I understand
the resulting assembly isn't outputted anywhere furthermore.  -What is
it?-

Disclaimer: The assembly was based on CS Architecture from an
undergrad 'MIPS' course- possibly not Intel, x86, or anything else.



More information about the Python-list mailing list