jsonforms icon indicating copy to clipboard operation
jsonforms copied to clipboard

Performance Issue for Custom Table renderer component

Open howdyAnkit opened this issue 1 year ago • 2 comments

Describe the bug

The given scenario highlights performance issues caused by excessive function calls, leading to latency problems, particularly in a nested object scenario within a custom Angular table renderer. To improve performance, consider optimizing the function calls and reducing unnecessary re-render.

Here's a a suggestion how I approached the problem using Angular's PurePipe to optimize function calls:

PurePipe: Utilize an Angular PurePipe to reduce unnecessary re-render of complex logic in the template.

while i was debugging I noticed that even while we are hovering certain elements this function was called unnecessarily multiple times even though when we are not making interacting with UI or performing any action.

By incorporating PurePipe in your Angular component, you can significantly optimize function calls and improve performance, especially in scenarios involving complex nested objects or custom renderers.

https://github.com/eclipsesource/jsonforms/blob/master/packages/angular-material/src/library/other/table.renderer.ts

Expected behavior

The getProps function should only be getting called when a user is performing any action releated to the Table to prevent memory leaks.

Steps to reproduce the issue

  1. Add a custom renderer(https://github.com/eclipsesource/jsonforms/blob/master/packages/angular-material/src/library/other/table.renderer.ts)
  2. Make sure you have lot of nested data and dataset is huge.
  3. place a console statement inside the getProp function and Observe the statement getting triggered on one click of add multiple times same with delete and also while you are hovering any elements on the table.

Screenshots

No response

Which Version of JSON Forms are you using?

v3.1.0

Framework

Angular

RendererSet

Material

Additional context

No response

howdyAnkit avatar Jan 06 '24 10:01 howdyAnkit

Hi @howdyAnkit , thank you for raising this issue. Would you like to contribute a fix for this? We would review and accept a contribution to improve this.

lucas-koehler avatar Jan 08 '24 08:01 lucas-koehler

Hi @lucas-koehler yes please assign it to me. will add a PR

howdyAnkit avatar Jan 08 '24 09:01 howdyAnkit