I looked at the virtual machine bytecode of python programs:

def f(whatever):
    text="Hallo"+whatever
    return text

import dis
dis.dis(f)
  2           0 LOAD_CONST               1 ('Hallo')
              3 LOAD_FAST                0 (whatever)
              6 BINARY_ADD
              7 STORE_FAST               1 (text)

  3          10 LOAD_FAST                1 (text)
             13 RETURN_VALUE


and now I am curious: how long does one LOAD_FAST take? I am thinking
of something like back in the assembler-world, where there existed
tables like:

LDA  -> 2 cycles
BNE  -> 2 cycles, 3 on branch

of course, the "real time" is dependand on many factors, esp. the
speed of the processor.
But ... is there a relative scale somewhere?

Somehting like

LOAD_CONST      1 arbitraryUnit
LOAD_FAST         1.9 arbitraryUnits
RETURN_VALUE   8.0 arbitraryUnits

???

my Google queries did not reveal anything usefull so far. Any hints?



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to