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

Draft refactoring of analysis #117

Closed
wants to merge 2 commits into from

Conversation

johandahlberg
Copy link
Contributor

This is not actually meant to be merged... I just wanted to put up a draft of a potential refactoring of the analysis module that I have been thinking about.

The idea here is to encapsulate different per component analysis functions as classes, and allow developers to implement new ones by implementing the PerComponentAnalysis. Then you would only have to deal with the actual analysis code, not with any of the surrounding things like creating the graph, setting up multiprocessing etc.

Other than making it easier to add new methods my initial benchmarks on this demonstrates that this is roughly ~6x faster than the current implementation. This is archived by to main changes. Firstly, the Graph object is only created once, and then passed to the different analysis steps. Secondly, it puts these methods on different processes.

The main drawback of this approach as I see it is that Graph instance creation is not parallelized, and it of course also has the overhead of having to pickle/unpickel the data as it is sent back and forth to the subprocesses.

I'd be happy to hear your thoughts about this approach and if you have any suggestions for improvements.

Copy link

codecov bot commented Mar 22, 2024

Codecov Report

Attention: Patch coverage is 0% with 110 lines in your changes are missing coverage. Please review.

Project coverage is 79.97%. Comparing base (90fd3c7) to head (58b940a).
Report is 417 commits behind head on dev.

Files Patch % Lines
src/pixelator/analysis/refactored_analysis.py 0.00% 110 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #117      +/-   ##
==========================================
+ Coverage   74.59%   79.97%   +5.37%     
==========================================
  Files          87      115      +28     
  Lines        4874     6412    +1538     
==========================================
+ Hits         3636     5128    +1492     
- Misses       1238     1284      +46     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@johandahlberg
Copy link
Contributor Author

Actual implementation lives in #127

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.

1 participant