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

perf: remove cloning/stringify of tracks #1

Draft
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

puehringer
Copy link

@puehringer puehringer commented Oct 20, 2022

Fix gosling-lang#823
Toward #

Change List

  • Removes many deep-clones of spec/data (like JSON.parse(JSON.stringify(...)) or structuredClone(...) as they also copy the underlying values when using json data type. This causes gosling to become very slow on zooming/panning.

TODOs

  • Clarify why the clones are actually necessary, and what we might break with removing them
    • In PubSub/event listeners: I understand the idea to return a deep-copy to avoid mutations, however that comes with a high cost. I would prefer this to be in the hands of the users of the library.
    • Everywhere else: I didn't see the spec being mutated inline (except for the cases where we changed it already).

Checklist

  • Ensure the PR works with all demos on the online editor
  • Unit tests added or updated
  • Examples added or updated
  • Documentation updated (e.g., added API functions)
  • Screenshots for visual changes (e.g., new encoding support or UI change on Editor)

*
* __Default:__ `random`
*/
sampleType?: 'first' | 'random';
Copy link

Choose a reason for hiding this comment

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

Cool, this would be a nice feature to have. Some users previously asked about having multiple methods (e.g., maintaining outliers).

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.

Improve performance of json-type by removing deep-clones of spec/data
2 participants