Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat empty filters {} the same as None. #514

Merged
merged 3 commits into from
Feb 20, 2021
Merged

Treat empty filters {} the same as None. #514

merged 3 commits into from
Feb 20, 2021

Conversation

bdice
Copy link
Member

@bdice bdice commented Feb 20, 2021

Description

I have been running benchmarks for synced collections (#484) and noticed that my project was loading state point data even when not requested.

I traced this down to the recent changes in #332 that changed the default filter behavior from None to {}. This prevented some of the "fast path" checks from triggering, and caused a full index for the project to be constructed.

Motivation and Context

Bug fix.

I don't know how to test this effectively, because it only affects internal APIs and performance, not correctness.

Types of Changes

  • Documentation update
  • Bug fix
  • New feature
  • Breaking change1

1The change breaks (or has the potential to break) existing functionality.

Checklist:

If necessary:

  • I have updated the API documentation as part of the package doc-strings.
  • I have created a separate pull request to update the framework documentation on signac-docs and linked it here.
  • I have updated the changelog and added all related issue and pull request numbers for future reference (if applicable). See example below.

@bdice bdice requested review from a team as code owners February 20, 2021 06:58
@bdice bdice requested review from b-butler and lyrivera and removed request for a team February 20, 2021 06:58
@codecov
Copy link

codecov bot commented Feb 20, 2021

Codecov Report

Merging #514 (f217886) into master (ffcc61a) will increase coverage by 0.15%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #514      +/-   ##
==========================================
+ Coverage   76.91%   77.06%   +0.15%     
==========================================
  Files          42       42              
  Lines        5830     5835       +5     
  Branches     1152     1154       +2     
==========================================
+ Hits         4484     4497      +13     
+ Misses       1057     1051       -6     
+ Partials      289      287       -2     
Impacted Files Coverage Δ
signac/contrib/project.py 85.08% <50.00%> (+0.60%) ⬆️
signac/__main__.py 71.89% <0.00%> (+0.44%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ffcc61a...f217886. Read the comment docs.

@vyasr
Copy link
Contributor

vyasr commented Feb 20, 2021

I'm fine with not testing this for now.I didn't notice that the innocuous-looking call to project._find_job_ids in JobsCursor.__iter__ that resulting from filter=None would be the difference between slow and fast iteration, so in lieu of specific testing I'm going to add some documentation of this behavior in a few places so that it's easier for developers to be aware.

@vyasr vyasr merged commit 27d6c9f into master Feb 20, 2021
@vyasr vyasr deleted the fix/empty-filter branch February 20, 2021 17:01
@vyasr vyasr mentioned this pull request Feb 20, 2021
12 tasks
@bdice bdice mentioned this pull request Aug 19, 2021
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants