YJ Park's profileYJParkPhotosBlogListsMore Tools Help

Blog


    4/24/2006

    Be Careful About Dict's Key

    I am trying to improve performance of some python code, in it, found out some big object are used as dict's key. It seems in python, it use repr(obj) to calculate it's hash instead of it's pointer. So using object as key is much slower than using it's pointer or some unique id, in my case more than 20 times slower. So after change this, just save more than 40% for a relative large data input.