daccotta-org / daccotta

A social network for movies.
https://app.daccotta.com
MIT License
84 stars 42 forks source link

Optimize Sorting by Removing Unnecessary Array Copy in JournalPage.tsx #290

Open sneha3004pandey opened 3 weeks ago

sneha3004pandey commented 3 weeks ago

In the JournalPage.tsx component, the sortedEntries function currently creates a shallow copy of filteredEntries (via const sorted = [...filteredEntries]) before sorting. This step may lead to memory inefficiency, as it duplicates the array even when a copy isn’t required for further use.

Issue: The line const sorted = [...filteredEntries].sort(...) creates an unnecessary shallow copy of filteredEntries, potentially increasing memory usage and affecting performance, especially with large datasets.

sid0000007 commented 2 weeks ago

@sneha3004pandey Go ahead