Skip to content

perf: Combat perf improvements#4070

Open
ilaykav wants to merge 5 commits intoscverse:mainfrom
ilaykav:combat-perf-improvements
Open

perf: Combat perf improvements#4070
ilaykav wants to merge 5 commits intoscverse:mainfrom
ilaykav:combat-perf-improvements

Conversation

@ilaykav
Copy link
Copy Markdown

@ilaykav ilaykav commented Apr 17, 2026

  • Closes # - Perf Improvement
  • Tests included or not required because: all tests pass, Added combat benchmark
  • Release notes not necessary because: internal perf improvement

Devloped on venv, ran benchamrk locally, main changes:

  • Replaced np.dot(x, np.ones(...)) with numpy broadcasting ([:, np.newaxis])
  • Extract .values from DataFrames before computation loops
    Benchmarked locally on 50K cells × 500 genes, 2-3 speedup on pp.combat

@ilaykav ilaykav changed the title fix: Combat perf improvements perf: Combat perf improvements Apr 17, 2026
@ilaykav ilaykav force-pushed the combat-perf-improvements branch from 7b601bf to c0e36aa Compare April 17, 2026 14:37
@flying-sheep flying-sheep added this to the 1.12.2 milestone Apr 17, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.60%. Comparing base (1f9b5ca) to head (c0e36aa).
⚠️ Report is 9 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4070      +/-   ##
==========================================
- Coverage   78.62%   78.60%   -0.02%     
==========================================
  Files         117      118       +1     
  Lines       12727    12753      +26     
==========================================
+ Hits        10006    10024      +18     
- Misses       2721     2729       +8     
Flag Coverage Δ
hatch-test.low-vers 77.90% <100.00%> (-0.02%) ⬇️
hatch-test.pre 78.48% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/scanpy/preprocessing/_combat.py 88.46% <100.00%> (-0.27%) ⬇️

... and 11 files with indirect coverage changes

@ilaykav
Copy link
Copy Markdown
Author

ilaykav commented Apr 17, 2026

~1.5x-2x times faster on 3K-20K cells, measured locally on my Intel i7-8665U python 3.14

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