Skip to content

Improve string size caching mechanism #3955

@bernardobelchior

Description

@bernardobelchior
  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

String size caching (implemented in DOMUtils.ts) is currently global for Recharts and has a maximum of 2000 keys. Plus, when it is over 2000 keys, it is purged completely.

This is an umbrella issue for possible improvements to the caching mechanism. Some ideas:

  1. Scope the string size cache by chart: this should reduce cache misses when all charts rendered on a page have over 2000 potential different string/style combinations at the cost of more memory
  2. Tweak the string size cache: maybe it should depend on the number of data points in a chart? Should it be configurable by an end user?
  3. Avoid purging the whole cache when over the 2000 keys and evict key on a FIFO basis

Feel free to provide more suggestions below.

More context can be found here.

What does the proposed API look like?

It may not require a new API. It depends on the paths that we want to take.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueIssues with this label are great for first time contributors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions