-
Notifications
You must be signed in to change notification settings - Fork 761
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[report-utilities] more efficient gnc:accounts-get-commodities
don't create intermediate lists which are immediately used and discarded. don't locale-compare commodity names, which has locale-transform overhead, and creates lots of temporary strings. testing for duplicates via O(N) member is very adequate because num(unique commodities) is expected to be small. use the stack when accumulating commodities, avoiding need to prepend and reverse.
- Loading branch information
1 parent
7a17b24
commit 1a5247c
Showing
4 changed files
with
8 additions
and
21 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
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
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
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
1a5247c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops testing for duplicates is O(n^2) but it's still ok because nobody will use gnucash to handle hundreds of commodities.
1a5247c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you can count on that, and you wrote
sort-and-delete-duplicates
explicitly to avoiddelete-duplicates
O(n^2) problem.OTOH this
looks like a good improvement over collecting all of the commodities, sorting, deleting the dupes, and then deleting the exclude.