[Product-Developers] How to search and sort content based on owner last login time?

Ricardo Newbery ric at digitalmarbles.com
Mon May 14 06:05:22 UTC 2012

On May 13, 2012, at 4:32 PM, zjs2k wrote:

> Thanks for the code. It will do exactly what I want. But I also have the
> performance concern if I have to sort thousands or more items. Maybe I
> should just iterate through the ordered users and do multiple catalog
> searches on Creator index. Use ajax on the page to delay display so I
> probably won't need to go through the whole list of users.
> You said more than one way to skin the cat. I would love to here more :)

Don't prematurely optimize for performance.  It's hard to say from what I've heard so far whether performance will be a real concern in your case.  A few thousand catalog result set may not be too bad.

That being said, a small optimization might be to memoize the final result.  Also, the last iteration in the example code which constructs the 'newresults' list isn't strictly necessary -- you can just pass the 'resultdict' to the template and have the template iterate through the users until it's generated the current display batch.


More information about the Product-Developers mailing list