-
Notifications
You must be signed in to change notification settings - Fork 36
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
Simplify internal indexing #652
Conversation
Codecov Report
@@ Coverage Diff @@
## next #652 +/- ##
==========================================
- Coverage 85.62% 85.55% -0.07%
==========================================
Files 51 51
Lines 5023 4999 -24
Branches 1005 1000 -5
==========================================
- Hits 4301 4277 -24
Misses 519 519
Partials 203 203
Continue to review full report at Codecov.
|
c6edf74
to
f8952db
Compare
Interesting observation while I was experimenting with this PR. Compare the following snippets:
The first one is slower because the While there is a way to provide a length hint to CPython for iterables without a |
Benchmarks look fine between fbb86df (current head of
|
@bdice can you rebase this on |
7f448c5
to
13f2a8f
Compare
@vyasr Just rebased. Take a peek now and see what you think. |
For posterity: another broad push for optimization would be to reduce the amount of code we use in the signac/signac/contrib/project.py Line 717 in b29e048
We copy a large amount of data used from the |
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.
Overall these changes look good, the removals in the Project class all seem sensible to me. One important question about the Collection change, let me know how confident you feel about it and I can re-review in more depth accordingly.
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.
Changes look clean and good.
* Simplify _index function. * Refactor _build_index for clarity/speed. * Remove Project._sp_index and Project._index_cache. * Remove Project._index. * Avoid unnecessary data copying when updating Collection indexes. * Revert optimizations to Collection. * Inline include_job_document.
* Simplify _index function. * Refactor _build_index for clarity/speed. * Remove Project._sp_index and Project._index_cache. * Remove Project._index. * Avoid unnecessary data copying when updating Collection indexes. * Revert optimizations to Collection. * Inline include_job_document.
* Simplify _index function. * Refactor _build_index for clarity/speed. * Remove Project._sp_index and Project._index_cache. * Remove Project._index. * Avoid unnecessary data copying when updating Collection indexes. * Revert optimizations to Collection. * Inline include_job_document.
* Simplify _index function. * Refactor _build_index for clarity/speed. * Remove Project._sp_index and Project._index_cache. * Remove Project._index. * Avoid unnecessary data copying when updating Collection indexes. * Revert optimizations to Collection. * Inline include_job_document.
* Simplify _index function. * Refactor _build_index for clarity/speed. * Remove Project._sp_index and Project._index_cache. * Remove Project._index. * Avoid unnecessary data copying when updating Collection indexes. * Revert optimizations to Collection. * Inline include_job_document.
* Simplify _index function. * Refactor _build_index for clarity/speed. * Remove Project._sp_index and Project._index_cache. * Remove Project._index. * Avoid unnecessary data copying when updating Collection indexes. * Revert optimizations to Collection. * Inline include_job_document.
* Simplify _index function. * Refactor _build_index for clarity/speed. * Remove Project._sp_index and Project._index_cache. * Remove Project._index. * Avoid unnecessary data copying when updating Collection indexes. * Revert optimizations to Collection. * Inline include_job_document.
* Simplify _index function. * Refactor _build_index for clarity/speed. * Remove Project._sp_index and Project._index_cache. * Remove Project._index. * Avoid unnecessary data copying when updating Collection indexes. * Revert optimizations to Collection. * Inline include_job_document.
* Simplify _index function. * Refactor _build_index for clarity/speed. * Remove Project._sp_index and Project._index_cache. * Remove Project._index. * Avoid unnecessary data copying when updating Collection indexes. * Revert optimizations to Collection. * Inline include_job_document.
* Simplify _index function. * Refactor _build_index for clarity/speed. * Remove Project._sp_index and Project._index_cache. * Remove Project._index. * Avoid unnecessary data copying when updating Collection indexes. * Revert optimizations to Collection. * Inline include_job_document.
* Simplify _index function. * Refactor _build_index for clarity/speed. * Remove Project._sp_index and Project._index_cache. * Remove Project._index. * Avoid unnecessary data copying when updating Collection indexes. * Revert optimizations to Collection. * Inline include_job_document.
* Simplify _index function. * Refactor _build_index for clarity/speed. * Remove Project._sp_index and Project._index_cache. * Remove Project._index. * Avoid unnecessary data copying when updating Collection indexes. * Revert optimizations to Collection. * Inline include_job_document.
* Simplify _index function. * Refactor _build_index for clarity/speed. * Remove Project._sp_index and Project._index_cache. * Remove Project._index. * Avoid unnecessary data copying when updating Collection indexes. * Revert optimizations to Collection. * Inline include_job_document.
* Simplify _index function. * Refactor _build_index for clarity/speed. * Remove Project._sp_index and Project._index_cache. * Remove Project._index. * Avoid unnecessary data copying when updating Collection indexes. * Revert optimizations to Collection. * Inline include_job_document.
Description
This PR simplifies the internal indexing behavior by eliminating some functions (
Project._index
,Project._sp_index
) and internal caches (Project._index_cache
) with behavior that is nearly-equivalent to other functions (Project._build_index
) and internal caches (Project._sp_cache
). See comments below. I'm opening this for review but need to make a final pass for changelog, etc.Motivation and Context
Types of Changes
1The change breaks (or has the potential to break) existing functionality.
Checklist:
If necessary: