[Compiler-sig] Bytecode

Dave zhu_dave at yahoo.com
Sat Oct 8 23:57:43 CEST 2005


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/compiler-sig/attachments/20051008/ae28bb7d/attachment.html


More information about the Compiler-sig mailing list