perf: Combat perf improvements#4070
Conversation
7b601bf to
c0e36aa
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4070 +/- ##
==========================================
- Coverage 78.60% 78.59% -0.02%
==========================================
Files 118 118
Lines 12753 12745 -8
==========================================
- Hits 10025 10017 -8
Misses 2728 2728
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
~1.5x-2x times faster on 3K-20K cells, measured locally on my Intel i7-8665U python 3.14 |
flying-sheep
left a comment
There was a problem hiding this comment.
hi, thanks! there are a few superficial issues.
About the general idea, why do you think that to_numpy() influences anything? For pandas arrays that already wrap underlying numpy arrays, the method should have basically no performance impact.
Benchmark changes
Comparison: https://github.com/scverse/scanpy/compare/d15aedeb0300d04bb327333e30bebfc0aa37d87c..d94816fc8f252ffa9a4f919aaacc80dbbf505eb4 More details: https://github.com/scverse/scanpy/pull/4070/checks?check_run_id=72836821961 |
|
You're right, the broadcasting itself (and the memory save from removing the np.ones allocations, not the .to_numpy()) is what actually made the impact, dropping the |
b15cf74 to
d94816f
Compare
Co-authored-by: Copilot <copilot@github.com>
|
thank you! |
…4085) Co-authored-by: Ilay Kavitzky <ilay.kavitzky@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Philipp A. <flying-sheep@web.de>
Devloped on venv, ran benchamrk locally, main changes:
.valuesfrom DataFrames before computation loopsBenchmarked locally on 50K cells × 500 genes, 2-3 speedup on pp.combat