# Filtering. Is there a way better than another?

**URL:** <https://gramps.discourse.group/t/filtering-is-there-a-way-better-than-another/2803>\
**Category:** Help\
**Created:** [September 23, 2022, 6:44pm UTC](https://gramps.discourse.group/t/filtering-is-there-a-way-better-than-another/2803 "2022-09-23T18:44:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PLegoux](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/plegoux/32/413_2.png) [@PLegoux](https://gramps.discourse.group/u/PLegoux)\
**Post date:** [September 23, 2022, 6:44pm UTC](https://gramps.discourse.group/t/filtering-is-there-a-way-better-than-another/2803/1 "2022-09-23T18:44:04Z")

</div>

> [@How is the Relationships view so responsive?](https://gramps.discourse.group/t/how-is-the-relationships-view-so-responsive/2802/1):
>
> It is often useful to run a filter that finds a subset of those: all the objects in one View category for immediate family of the Active Person. And to do that, Gramps requires a (divergent set of rules for each Category) complex mulit-stage custom filter. And it has a painfully slow progress bar for each stage.

I come back to this remark by wondering if there are methods or orders of filters better than others (when possible), which allow the filters to be executed more quickly. I’m a big user of filters, I have hundreds of them, and it’s true that they can sometimes be slow. Would there be preferred filters (one that looks for type and the other that looks for type, date, description… in which only the type is indicated, for example)?

Do you have any idea about the performance of the filters and how best to use them?

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [September 23, 2022, 7:04pm UTC](https://gramps.discourse.group/t/filtering-is-there-a-way-better-than-another/2803/2 "2022-09-23T19:04:35Z")

</div>

One of the useful beta test features that @cdhorn incorporated into his CardView was a timing functionality so he could troubleshoot performance issues.

 ![image](https://global.discourse-cdn.com/free1/uploads/gramps/original/2X/d/dbac7d2a516b6b445e853cdf8dc45fce19652419.png)

Perhaps we could prevail upon @kku to add a timing functionality to the “Test Run” of [FilterParams](https://gramps-project.org/wiki/index.php/Addon:Isotammi_addons#FilterParams_tool) and a similar checkbox for the [SuperTool](https://gramps-project.org/wiki/index.php/Addon:Isotammi_addons#SuperTool)’s results when Executing?

Including timing is probably just a matter of adding a few lines before & after the code block passed through the [Query Gramplet](https://gramps-project.org/wiki/index.php/Addon:QueryGramplet).

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [September 28, 2022, 4:00pm UTC](https://gramps.discourse.group/t/filtering-is-there-a-way-better-than-another/2803/3 "2022-09-28T16:00:25Z")

</div>

Found an interesting article “[Python Timer Functions: Three Ways to Monitor Your Code](https://realpython.com/python-timer/) by [Geir Arne Hjelle](https://realpython.com/python-timer/#author) Mar 21, 2022” on RealPython dot com.

He notes some methods offer threaded timings. And since there have been some experiments in pushing CPU-hungry Gramps add-ons to idle cores in a multi-core system, that sounds good too.

---

<div class="post-metadata">

**Author:** ![Mattkmmr](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/mattkmmr/32/410_2.png) [@Mattkmmr](https://gramps.discourse.group/u/Mattkmmr)\
**Post date:** [October 1, 2022, 2:22pm UTC](https://gramps.discourse.group/t/filtering-is-there-a-way-better-than-another/2803/4 "2022-10-01T14:22:26Z")

</div>

> [@PLegoux](#):
>
> Do you have any idea about the performance of the filters and how best to use them?

1. Filters used in the filter sidebar are slowest, especially multi-step filters where each step of is slowing the process.
2. Supertool and filter rule addons combining multi-step filters are faster.
3. Searching cached data e.g. searchbar in person list view is also faster, but only allows searching displayed data.

---

<div class="post-metadata">

**Author:** ![emyoulation](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/emyoulation/32/67_2.png) [@emyoulation](https://gramps.discourse.group/u/emyoulation)\
**Post date:** [October 1, 2022, 2:58pm UTC](https://gramps.discourse.group/t/filtering-is-there-a-way-better-than-another/2803/5 "2022-10-01T14:58:56Z")

</div>

> [@emyoulation](#):
>
> add a timing functionality to the “Test Run” of [FilterParams](https://gramps-project.org/wiki/index.php/Addon:Isotammi_addons#FilterParams_tool) and a similar checkbox for the [SuperTool](https://gramps-project.org/wiki/index.php/Addon:Isotammi_addons#SuperTool)’s results when Executing?

SuperTool already includes a gross execution timing (measured in hundredths of a second) above the results readout.  
 ![image](https://global.discourse-cdn.com/free1/uploads/gramps/original/2X/a/a241676d82772e620b5a07885e03688a24715b89.png)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/gramps/original/1X/2ac1e712b7adf612e31ca08a55419f4cf37c0158.png) [@system](https://gramps.discourse.group/u/system)\
**Post date:** [October 31, 2022, 2:59pm UTC](https://gramps.discourse.group/t/filtering-is-there-a-way-better-than-another/2803/6 "2022-10-31T14:59:24Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
