-
Notifications
You must be signed in to change notification settings - Fork 431
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor, fix, and optimize filters/rules
This change does four things: 1. Unrolls the recursive call of filter.apply(), and splits out single checks into filter.apply_to_one(). 2. Uses data attributes (`person.gender`) rather than accessor functions (`person.get_gender()`) where possible. 3. Adds an optimizer based on `rule.selected_handles` sets. 4. Adds typing hints to make sure the right objects are passed into methods. Final comparison of finding those related to home person in 40k person Family Tree, between Gramps 5.2 and this change (Gramps 6.0), in seconds (smaller is better): Version | Prepare Time | Apply Time | Total Time --------| -------------:|-----------:|----------: Gramps 5.2 | 4.5 | 27.7 | 32.2 Gramps 6.0 | 8.0 | 0.5 | 8.5 The above uses the optimizer. Here is a test finding all people with a tag (5 people match): Version | Prepare Time | Apply Time | Total Time --------| -------------:|-----------:|----------: Gramps 5.2 | 0.0 | 5.0 | 5.0 Gramps 6.0 | 0.0 | 1.6 | 1.6 Recall that converting from JSON to objects is a little slower than converting from array BLOBS to objects, so this is a large improvement. Co-authored-by: Christopher Horn <[email protected]> Co-authored-by: stevenyoungs <[email protected]>
- Loading branch information
Showing
152 changed files
with
2,579 additions
and
987 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,3 +71,5 @@ | |
from .undoredo import * | ||
from .utils import * | ||
from .generic import * | ||
|
||
Database = DbGeneric |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
# Copyright (C) 2015-2016 Gramps Development Team | ||
# Copyright (C) 2016 Nick Hall | ||
# Copyright (C) 2024 Doug Blank | ||
# Copyright (C) 2024,2025 Steve Youngs <[email protected]> | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
|
@@ -2782,3 +2783,6 @@ def set_serializer(self, serializer_name): | |
self.serializer = BlobSerializer | ||
elif serializer_name == "json": | ||
self.serializer = JSONSerializer | ||
|
||
|
||
Database = DbGeneric |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.