Commit b56c92d
Speed up datashader rendering of points (#379)
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>1 parent edca5a5 commit b56c92d
3 files changed
+64
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
65 | 70 | | |
66 | | - | |
| 71 | + | |
67 | 72 | | |
68 | 73 | | |
69 | | - | |
| 74 | + | |
70 | 75 | | |
71 | 76 | | |
72 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
73 | 80 | | |
74 | 81 | | |
75 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | | - | |
85 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
86 | 88 | | |
87 | | - | |
| 89 | + | |
88 | 90 | | |
89 | | - | |
90 | | - | |
91 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
| |||
828 | 830 | | |
829 | 831 | | |
830 | 832 | | |
831 | | - | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
832 | 837 | | |
833 | 838 | | |
834 | 839 | | |
835 | 840 | | |
836 | | - | |
| 841 | + | |
837 | 842 | | |
838 | | - | |
839 | | - | |
| 843 | + | |
| 844 | + | |
840 | 845 | | |
841 | 846 | | |
842 | 847 | | |
| |||
901 | 906 | | |
902 | 907 | | |
903 | 908 | | |
904 | | - | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
905 | 913 | | |
906 | 914 | | |
907 | 915 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2973 | 2973 | | |
2974 | 2974 | | |
2975 | 2975 | | |
2976 | | - | |
2977 | | - | |
2978 | | - | |
| 2976 | + | |
| 2977 | + | |
| 2978 | + | |
2979 | 2979 | | |
2980 | 2980 | | |
2981 | 2981 | | |
2982 | | - | |
2983 | | - | |
2984 | | - | |
| 2982 | + | |
| 2983 | + | |
| 2984 | + | |
| 2985 | + | |
2985 | 2986 | | |
2986 | 2987 | | |
2987 | 2988 | | |
| |||
3015 | 3016 | | |
3016 | 3017 | | |
3017 | 3018 | | |
| 3019 | + | |
| 3020 | + | |
| 3021 | + | |
| 3022 | + | |
| 3023 | + | |
| 3024 | + | |
| 3025 | + | |
| 3026 | + | |
| 3027 | + | |
| 3028 | + | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
| 3032 | + | |
| 3033 | + | |
| 3034 | + | |
| 3035 | + | |
| 3036 | + | |
| 3037 | + | |
| 3038 | + | |
| 3039 | + | |
| 3040 | + | |
| 3041 | + | |
| 3042 | + | |
| 3043 | + | |
| 3044 | + | |
| 3045 | + | |
3018 | 3046 | | |
3019 | 3047 | | |
3020 | 3048 | | |
| |||
0 commit comments