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

Optimize Memory and Performance in waveform.js #127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Aug 29, 2023

  1. Optimize Memory and Performance in waveform.js

    This pull request introduces a series of optimizations aimed at improving the performance and memory usage of the waveform.js file. The changes focus on pre-allocating arrays where possible, optimizing array manipulations, and replacing library-specific methods with native JavaScript alternatives where appropriate.
    
    Key Changes:
    - Pre-allocated the samples array as a Float64Array to reduce dynamic memory allocations.
    - Introduced sampleCount to keep track of the number of samples, allowing us to trim the pre-allocated samples array to its actual size.
    - Replaced the non-existent d3.maxIndex function with native JavaScript code to find the index of the maximum RMS value.
    
    These changes aim to enhance the performance and reduce the memory footprint of the getWaveform function, especially when working with large audio files.
    
    Please review and test these changes thoroughly to ensure they meet all functional and performance requirements.
    mplawner committed Aug 29, 2023
    Configuration menu
    Copy the full SHA
    c43f6cd View commit details
    Browse the repository at this point in the history