Bytecode
Dave <[email protected]> Sat, 8 Oct 2005 14:57:43 -0700 (PDT)
| Newsgroups | gmane.comp.python.compiler |
|---|---|
| Message-ID | <[email protected]> |
--===============1114471704== Content-Type: multipart/alternative; boundary="0-143523207-1128808663=:80638" Content-Transfer-Encoding: 8bit --0-143523207-1128808663=:80638 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hello All, I would like to gather some information on Python's runtime performance. As far as I understand, it deals with a lot of string objects. Perhaps, it requires a lot of string processing during program execution. So, I wrote a simple program which does simple operations on a class object. Then, I disassembled the code and looked at the bytecode. Here is what I couldn't understand: For example, myClass.variable1 is disassembled as follows: LOAD_FAST 1 (myClass) LOAD_ATTR 4 (variable1) What I found out is that LOAD_ATTR namei replaces the top of the stack (TOS) with getattr(TOS, co_names[namei]). My question is: In this example, does it need any string processing to access co_names[variable1]? Or does getattr function need any string processing? Thanks a lot for your help! --------------------------------- Yahoo! Music Unlimited - Access over 1 million songs. Try it free. --0-143523207-1128808663=:80638 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit <DIV> <DIV>Hello All,</DIV> <DIV> </DIV> <DIV>I would like to gather some information on Python's runtime performance. As far as I understand, it deals with a lot of string objects. Perhaps, it requires a lot of string processing during program execution. So, I wrote a simple program which does simple operations on a class object. Then, I disassembled the code and looked at the bytecode. Here is what I couldn't understand:</DIV> <DIV> </DIV> <DIV>For example, <B>myClass.variable1</B> is disassembled as follows: <BR><BR><B>LOAD_FAST 1 (myClass)<BR>LOAD_ATTR 4 (variable1) </B><BR><BR>What I found out is that <B>LOAD_ATTR namei</B> replaces the top of the stack (TOS) with getattr(TOS, co_names[namei]). My question is:</DIV> <DIV> </DIV> <DIV>In this example, does it need any string processing to access co_names[variable1]? Or does getattr function need any string processing? </DIV> <DIV> </DIV> <DIV>Thanks a lot for your help!</DIV></DIV><p> <hr size=1> <a href="http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=36035/*http://music.yahoo.com/unlimited/">Yahoo! Music Unlimited - Access over 1 million songs. Try it free.</a> --0-143523207-1128808663=:80638-- --===============1114471704== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Compiler-sig mailing list [email protected] http://mail.python.org/mailman/listinfo/compiler-sig --===============1114471704==--