Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #557 +/- ##
==========================================
- Coverage 73.89% 73.84% -0.06%
==========================================
Files 10 10
Lines 2777 2783 +6
Branches 645 644 -1
==========================================
+ Hits 2052 2055 +3
- Misses 451 454 +3
Partials 274 274
🚀 New features to boost your workflow:
|
b56c92d to
240a5d2
Compare
Datashader was consistently slower than matplotlib for points due to five performance bottlenecks: 1. Dask DataFrame passed to cvs.points() instead of pandas (~137x scheduler overhead on already-computed data) 2. Double extent computation (get_extent on dask, then .compute again) 3. Per-point _hex_no_alpha() calls in O(n) list comprehension 4. _build_datashader_color_key iterated all points instead of early-exiting after finding all categories 5. _want_decorations created O(n) Python set from color vector After fixes, datashader is 1.2-1.4x faster than matplotlib for plain points and up to 1.6x faster for categorical coloring at 500K+ points. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
240a5d2 to
e1f1ad4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #379
Datashader was consistently slower than matplotlib for rendering points due to five performance bottlenecks in the datashader code path. This PR fixes all five:
cvs.points()—PointsModel.parse()returns dask, but datashader's dask path has ~137x scheduler overhead on already-computed data. Fix:.compute()before aggregation.get_extent()on dask (triggering compute), then.compute()was called again. Fix: new_datashader_canvas_from_dataframe()that reads min/max directly from the materialized pandas DataFrame._hex_no_alpha()calls — O(n) list comprehension even when no alpha stripping was needed. Fix: deduplicate + skip when all colors already in#RRGGBBformat._build_datashader_color_keyiterated all points — used expensive per-element pandas Index lookups and couldn't early-exit because sentinel categories inflated the target count. Fix: numpy arrays + count only present categories._want_decorationsO(n) set creation —set(cv.tolist())on 500K+ hex strings. Fix: numpy(cv == cv.flat[0]).all().Performance results (after JIT warmup)
No coloring:
Categorical coloring: