Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve system storage and data structure #278

Merged
merged 34 commits into from
Jan 20, 2024
Merged

Conversation

bryanlundberg
Copy link
Owner

@bryanlundberg bryanlundberg commented Jan 13, 2024

What does this PR do?

  • Implement a backup panel and compatibility with the backup from other online timers.
  • Change from localStorage to indexDB
  • Improve execution time for calculating statistics
  • Improve rendering resolves (React renders only the visible part of the array of solves, avoiding rendering +30k items per refresh). It was a issue for big data sets.

Related Issue(s)
#226

Screenshots or GIFs (if applicable)
image

Importing status:

image

Checklist

  • Import panel
  • Nexus timer compatibility
  • csTimer compatibility
  • TwistyTimer compatibility
  • Cubedesk compatibility
  • Transition from localStorage to indexDB
  • Error handling corrupted files
  • Translations for import modal

@bryanlundberg bryanlundberg linked an issue Jan 13, 2024 that may be closed by this pull request
@bryanlundberg bryanlundberg added the enhancement New feature or request label Jan 14, 2024
Copy link
Owner Author

@bryanlundberg bryanlundberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need add - Compress images and redirect to /cubes after a successful import

Copy link
Owner Author

@bryanlundberg bryanlundberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need optimization; restoring from a large text file, crashes the browser.

Copy link
Owner Author

@bryanlundberg bryanlundberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requires changing from localStorage to indexedDB due to low storage capacity

image

Copy link
Owner Author

@bryanlundberg bryanlundberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional testing is required at the moment. Currently, no errors have been detected in the standard system after migrate from localStorage to indexDB. We can proceed to resume the import feature.

Copy link
Owner Author

@bryanlundberg bryanlundberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its needed allow users to edit the cube category from /cubes since Cubedesk and CSTimer its not easy deduce the original category, and it could even be mixed. Will be the user's responsibility to make the necessary corrections.

Copy link
Owner Author

@bryanlundberg bryanlundberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current implementation is very slow and redundant writting and reading DB. The application experiences dropdowns in FPS that almost crash the browser when updating the selected cube statistics calculations after each solve and moving between pages.

It becomes notably slow, especially when there are more than 20,000 solves. (Big amount of data)

We can try removing unnecessary data pulls from the database (each read takes 2s), instead, maintain a updated copy in memory.

Copy link
Owner Author

@bryanlundberg bryanlundberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The low performance might be related to the multiple uses of 'useTimerStatistics.ts', causing the rendering of overall statistics five times each time a solve its added.

statistics calculations are excecuted 5times each render.

image

@bryanlundberg bryanlundberg marked this pull request as ready for review January 19, 2024 04:05
@bryanlundberg
Copy link
Owner Author

bryanlundberg commented Jan 19, 2024

calculations now are stored a single time with zustand state, instead multiple states everywhere.

  • Statistics refresh when cubes data are changed (only 1 time).
  • Optimized loops inside statistics functions

Before: 2500 - 3000 ms - 1 render

After: 23ms - 1 render

image

@bryanlundberg bryanlundberg changed the title add import compatibility with other online timers Improve system storage and data structure Jan 20, 2024
Copy link
Owner Author

@bryanlundberg bryanlundberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

@bryanlundberg bryanlundberg merged commit 440dc53 into main Jan 20, 2024
2 checks passed
@bryanlundberg bryanlundberg deleted the import-backups branch January 20, 2024 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add import compatibility with other timers online
1 participant