"Jay Tee" <[EMAIL PROTECTED]> wrote: > Hi, > > I have some code that does, essentially, the following: > > - gather information on tens of thousands of items (in this case, jobs > running on a > compute cluster) > - store the information as a list (one per job) of Job items > (essentially wrapped > dictionaries mapping attribute names to values) > > and then does some computations on the data. One of the things the > code needs to do, very often, is troll through the list and find jobs > of a certain class: > > for j in jobs: > if (j.get('user') == 'jeff' and j.get('state')=='running') : > do_something() > > This operation is ultimately the limiting factor in the performance. > What I would like to try, if it is possible, is instead do something > like this: >
When you are gathering the data and building the lists - why do you not simultaneously build a dict of running jobs keyed by the Jeffs? - Hendrik -- http://mail.python.org/mailman/listinfo/python-list