Skip to content

Add optimisations#1

Merged
timothyhoward merged 1 commit into
mainfrom
feature/optimisation
Apr 7, 2026
Merged

Add optimisations#1
timothyhoward merged 1 commit into
mainfrom
feature/optimisation

Conversation

@alisha17

@alisha17 alisha17 commented Apr 7, 2026

Copy link
Copy Markdown
Collaborator

1. Cached Intl.NumberFormat instances (format.ts)

  • Added a formatterCache map keyed by serialized options
  • Replaced all 8 new Intl.NumberFormat() / .toLocaleString() call sites with cachedFormatter()
  • Updated DataTable.tsx to use formatChartKitNumber instead of inline toLocaleString
  • Formatters are now created once per unique config and reused across all subsequent calls

3. Shared useChartSeries hook

  • Created useChartSeries.ts with the row-pivoting logic wrapped in useMemo
  • BarChart and LineChart now import useChartSeries instead of duplicating ~40 lines each
  • The pivot result is memoized on the actual field props + rows reference

4. Removed redundant registerDataSources in db-manager.ts

  • createDuckDbRuntime already calls registerDataSources internally with the initial sources
  • Removed the second identical call that was iterating + JSON-serializing every source for nothing on new runtimes

@alisha17
alisha17 requested a review from timothyhoward April 7, 2026 02:39
@timothyhoward
timothyhoward merged commit 0e5f033 into main Apr 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants