Avoid copy when dropping attributes#483
Avoid copy when dropping attributes#483Bisaloo wants to merge 3 commits into
Conversation
|
| Project | anndataR |
| Branch | fewer-conversion |
| Testbed | ubuntu-latest |
⚠️ WARNING: Truncated view!The full continuous benchmarking report exceeds the maximum length allowed on this platform.
🚨 21 Alerts
🐰 View full continuous benchmarking report in Bencherd92bf25 to
dbcf776
Compare
dbcf776 to
fd767b5
Compare
|
Looks interesting! If it improves performance, I'd definitely be down! :) |
fd767b5 to
a5495d0
Compare
|
LGTM when you feel this PR is ready for a review, or what additional changes you think need to be made :) |
|
On a 413 MB "X" layer: cross::bench_branches(
{
bench::mark(
anndataR:::read_zarr_sparse_array("adata", "X"),
iterations = 50
)
},
branches = "devel"
)Not as huge as what I'd have hoped but I think it can still be noticeable, especially on spatialdata objects with multiple anndata components. This is good to go as far as I'm concerned. |
|
Related: This step: Line 297 in 7b7737c is slow and somewhat unintuitive. I have an X layer where the But it seems that if we leave |
Description
I may be missing something so mostly opening this for discussion for now.
In many cases, it seems anndataR wants a vector instead of an array with a single dimension. In the current code, this is usually achieved via
as.vector()/as.integer()/ etc.But this is very inefficient because it results in a entire new copy of the object in memory.
Would it work for you to drop the
dimattribute? In your use case, it should not result in an additional copy of the data.Created on 2026-07-20 with reprex v2.1.1
I took a reasonably large test dataset but note that this get much worse with larger datasets, while remove
dimalways remains free, independent of the dataset size.Checklist
Before review
Before merge
NEWS