python function slowing down for no apparent reason

后端 未结 6 1078
小鲜肉
小鲜肉 2021-01-22 16:56

I have a python function defined as follows which i use to delete from list1 the items which are already in list2. I am using python 2.6.2 on windows XP

def comp         


        
6条回答
  •  臣服心动
    2021-01-22 17:25

    If we rule the data structure itself out, look at your memory usage next. If you end up asking the OS to swap in for you (i.e., the list takes up more memory than you have), Python's going to sit in iowait waiting on the OS to get the pages from disk, which makes sense given your description.

    Is Python sitting in a jacuzzi of iowait when this slowdown happens? Anything else going on in the environment?

    (If you're not sure, update with your platform and one of us will tell you how to tell.)

提交回复
热议问题