Commit 3e5d3ee
committed
perf(shapes): drop the per-render table join when coloring by a table column
_render_shapes joined the element to its annotating table via _join_table_for_element, whose
table[indices, :].copy() does an out-of-order sparse CSR row-gather copy of the whole AnnData
(~150 ms on Visium-width tables, more on Xenium/Visium-HD). After #709 color is resolved per shape
by _extract_color_column (region-masks + reindexes the table itself) and after #711 the join is a
left join, so the joined element/table are no longer needed: use the original element + table.
An audit confirms no downstream consumer needs the joined table - the matplotlib/datashader draws
never touch it, _decorate_axs's adata is a dead parameter, and .uns custom colors are read from
sdata[table_name] inside _set_color_source_vec. Output is pixel-identical to the join path (verified
on partial-annotation/na_color, fully-annotated, real datashader (curio 69k) and real Visium), so the
visual baselines are unchanged. Measured: visium_hne render_shapes(color=gene) 451 ms -> 297 ms (1.52x).
The outline path keeps its own (rarer) join; converting it is a separate follow-up.1 parent 2066b57 commit 3e5d3ee
1 file changed
Lines changed: 5 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
600 | 600 | | |
601 | 601 | | |
602 | 602 | | |
603 | | - | |
604 | | - | |
| 603 | + | |
| 604 | + | |
605 | 605 | | |
606 | 606 | | |
607 | 607 | | |
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
613 | | - | |
614 | 613 | | |
| 614 | + | |
| 615 | + | |
615 | 616 | | |
616 | | - | |
617 | | - | |
618 | | - | |
| 617 | + | |
619 | 618 | | |
620 | 619 | | |
621 | 620 | | |
| |||
0 commit comments