Am 21.03.2011 09:32, schrieb Laszlo Nagy: > I must also tell you that the os.stat call is taking long because this > system has about 7 million files on a slow disk. It would be normal for > an os.stat call to return after 10 seconds. I have no problem with that. > But I think that the 100% CPU is not acceptable. I guess that the code > is running in kernel mode. I think this because I can send a KILL signal > to it and the state changes to the following:
What's your operating system and file system? A better file system or system setting may increase your performance a lot. XFS or ext3 / ext4 with hashed directory index increases the file lookup part from O(n) to O(1). > Could it be a problem with the operation system? Is it possible that an > os.stat call requires 100% CPU power from the OS? Or is it a problem > with the Python implementation? It's mostly likely a problem with the OS, hardware and/or your configuration. Python doesn't come with its own stat() implementation. os.stat() just wraps the libc's stat() function. The heavy lifting is done inside libc and the kernel. Christian -- http://mail.python.org/mailman/listinfo/python-list