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


##########
superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.jsx:
##########
@@ -620,6 +622,8 @@ export class TableRenderer extends Component {
     } = this.props.tableOptions;
     const flatRowKey = flatKey(rowKey);
 
+    const totalRowsCount = visibleRowKeys.length + (colTotals ? 1 : 0);

Review Comment:
   ### Redundant calculation in row rendering loop <sub>![category 
Performance](https://img.shields.io/badge/Performance-4f46e5)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The totalRowsCount calculation is performed on every row render, causing 
unnecessary repeated computation.
   
   
   ###### Why this matters
   This calculation will be executed for each row in the table during 
rendering, leading to redundant computations that could impact performance with 
large datasets.
   
   ###### Suggested change ∙ *Feature Preview*
   Move the totalRowsCount calculation outside the renderTableRow method to the 
render method or pivotSettings object, so it's computed once per render cycle 
instead of once per row.
   
   
   ###### 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/95bec8f9-1543-4854-914d-eeb33991a9b8/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/95bec8f9-1543-4854-914d-eeb33991a9b8?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/95bec8f9-1543-4854-914d-eeb33991a9b8?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/95bec8f9-1543-4854-914d-eeb33991a9b8?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/95bec8f9-1543-4854-914d-eeb33991a9b8)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:fb376f68-5391-439d-9b47-9a37279e9c88 -->
   
   
   [](fb376f68-5391-439d-9b47-9a37279e9c88)



-- 
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