From: <ste...@gm...> - 2007-08-30 16:09:29
|
> Stephane, > > i think you can improve the performance of your filter if you break the > for loop > if not ok, instead of for all handles running over all backlinks. > > So eg : > > for item in db.find_backlink_handles(handle): > count += 1 > if count > value : > return False But what if the filter is to see if count > value -- then I'd have to return True. This means putting the return logic code inside the "for" loop. Are you certain putting the logic return code inside the for loop and executing it for every handle would really be faster? > would greatly improve performance, especially if value=0. > Also, if you put > > value = int(self.list[1]) > > in the prepare method, as > def prepare(...) > self.value = int(self.list[1]) > > you avoid doing the str to int conversion for every handle that is passed. > In the same way, you can store the self.list[0] as an integer in the prepar > e, > avoiding the need to check with a translated _('lesser than') > This removes the gettext call on every handle, and improves the equality > checking. Thanks! I didn't know about prepare(). Now I see other examples of it. I'll take care of it today. Stephane |