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 Startup Times via Threading #4951

Merged
merged 6 commits into from
Jun 9, 2021

Commits on May 28, 2021

  1. Add job thread profiling

    Web-eWorks committed May 28, 2021
    Configuration menu
    Copy the full SHA
    f769e98 View commit details
    Browse the repository at this point in the history
  2. Load sounds and music in background thread

    FileSystem appears to be threadsafe, but could probably use some more
    investigation to ensure that we're not inadvertently causing a data race.
    Web-eWorks committed May 28, 2021
    Configuration menu
    Copy the full SHA
    b88f164 View commit details
    Browse the repository at this point in the history
  3. Add async loading to application startup

    Add async overall and per-step JobSet queues to Pi::App for startup code.
    Load steps now wait for async jobs to complete before progressing.
    The loading screen now waits for all async jobs to transition to menu.
    Web-eWorks committed May 28, 2021
    Configuration menu
    Copy the full SHA
    ce96000 View commit details
    Browse the repository at this point in the history

Commits on May 29, 2021

  1. Scan the face part database on background threads.

    This takes the FaceParts init step (with prewarmed fs cache) to ~220ms from 440ms.
    
    Run FacePart initialization on the background queue (not needed by further steps).
    Web-eWorks committed May 29, 2021
    Configuration menu
    Copy the full SHA
    bfd846f View commit details
    Browse the repository at this point in the history
  2. Fix merge conflicts, improve thread name reporting

    Remove further unnecessary profiling points.
    This cleans up ~1/4th of the profile events during star system cache generation.
    Web-eWorks committed May 29, 2021
    Configuration menu
    Copy the full SHA
    7957a05 View commit details
    Browse the repository at this point in the history
  3. Finalize as many completed jobs as possible

    Instead of finishing one job per thread per frame, now copy job pointers to an on-thread array and run their finalizers in one pass.
    
    This means we can queue potentially 1000s of jobs in a single frame / load step without then needing to finalize them over the next 250 frames.
    
    Potentially investigate an upper limit on the number of finalized jobs; e.g. 100/thread/frame to avoid frame hitches.
    Web-eWorks committed May 29, 2021
    Configuration menu
    Copy the full SHA
    986ba8f View commit details
    Browse the repository at this point in the history