korbit-ai[bot] commented on code in PR #35537:
URL: https://github.com/apache/superset/pull/35537#discussion_r2407848542


##########
superset-frontend/plugins/legacy-preset-chart-deckgl/src/CategoricalDeckGLContainer.tsx:
##########
@@ -163,6 +163,25 @@ const CategoricalDeckGLContainer = (props: 
CategoricalDeckGLContainerProps) => {
           }));
         }
         case COLOR_SCHEME_TYPES.categorical_palette: {
+          // If no dimension selected, fall back to fixed color
+          if (!fd.dimension) {
+            const fallbackColor = fd.color_picker || {
+              r: 0,
+              g: 0,
+              b: 0,
+              a: 100,
+            };
+            return data.map(d => ({
+              ...d,
+              color: [
+                fallbackColor.r,
+                fallbackColor.g,
+                fallbackColor.b,
+                fallbackColor.a * 255,
+              ],
+            }));

Review Comment:
   ### Inefficient array creation in data mapping <sub>![category 
Performance](https://img.shields.io/badge/Performance-4f46e5)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The color array is recreated for every data point when using fallback color, 
causing O(n) unnecessary array allocations.
   
   
   ###### Why this matters
   With large datasets, this creates significant memory pressure and CPU 
overhead from repeated array creation and the spread operator on each data 
object.
   
   ###### Suggested change ∙ *Feature Preview*
   Pre-compute the color array outside the map function:
   
   ```typescript
   const colorArray = [
     fallbackColor.r,
     fallbackColor.g, 
     fallbackColor.b,
     fallbackColor.a * 255,
   ];
   return data.map(d => ({ ...d, color: colorArray }));
   ```
   
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice 
Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/95b80dac-48a4-44e3-a438-39d672512dcf/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/95b80dac-48a4-44e3-a438-39d672512dcf?what_not_true=true)
  [![Not in 
Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/95b80dac-48a4-44e3-a438-39d672512dcf?what_out_of_scope=true)
 [![Not in coding 
standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/95b80dac-48a4-44e3-a438-39d672512dcf?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/95b80dac-48a4-44e3-a438-39d672512dcf)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:5f9e834b-ded3-4f58-a4ae-0575c1901c56 -->
   
   
   [](5f9e834b-ded3-4f58-a4ae-0575c1901c56)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to