Skip to content

improve start time by populating sketchbook/libraries on threads #2945

Closed as not planned

Description

@benfry
No description provided.

Activity

  1. added
    help wanted
    on Nov 15, 2014
  2. joelmoniz commented on Dec 18, 2014

    @joelmoniz
    Member

    To clarify, this would involve running the population of the "Open Recent" and "Import Library..." menus on separate background threads, so that they no longer block the main thread, thereby (effectively) saving on I/O time (since the I/O now takes place in a background thread), right?

  3. benfry commented on Apr 5, 2015

    @benfry
    ContributorAuthor

    @joelmoniz it's for the methods that rebuild the sketchbook menu. It's very slow to walk the sketchbook hierarchy, looking for sketches, libraries, tools, etc. If you have dozens of sketches, or a even a single sketch that's used saveFrame() to create 1000s of files, the I/O will be extremely slow. (Even worse if your machine doesn't have an SSD.)

  4. joelmoniz commented on Jun 18, 2015

    @joelmoniz
    Member

    Ah, thank you. I'm almost done working on this, and should be able to file PR by tomorrow. Could you please clarify one small point for me? Does the sketchbook menu refer to File>Sketchbook, or to Sketch? I did some profiling, and the former does not seem to affect the start time at all, since the first time the sketchbook is actually walked searching for sketches is here, when the user actually clicks on the File>Sketchbook menu item. Tool, etc. do however, and I'll submit a PR that improves this.

  5. benfry commented on Jun 19, 2015

    @benfry
    ContributorAuthor

    Sorry, I misspoke. It's for the methods that walk the sketchbook... These are for 1) getting the list of sketches (to put in the sketchbook window, in the past this was a menu, which is what I was referring to in the previous comment), 2) getting the modes, libraries, and tools. If you have a large sketchbook, or a lot of libraries installed, all or some of these can take a very long time to load.

    If it's something that's needed immediately, that can't be done on a thread, but depending on the situation, this can happen in the background. The fix isn't terribly difficult, it just requires looking at the code very closely to make sure that we're doing it in the right place and taking all the scenarios into account.

  6. joelmoniz commented on Jun 19, 2015

    @joelmoniz
    Member

    Ah, thank you. As far as I could see, the walking is done just-in-time, when the user actually opens the Sketchbook window. I've profiled the code too, and though I had several large sketches (1+ GB each), this doesn't affect start time at all (the method call doesn't even show up on the profiler). I'll look into this a little more and make sure that this is indeed so.

    There is one problem I'm facing, however. The maximum amount of time seems to be taken to load up Tools, for some reason. And though they aren't required immediately, and I'm able to offload their loading onto threads, updating the Tool menu sometimes tends to cause an error to be thrown, even though I've made it a point to ensure that all swing operations have been done on the EDT (a ClassCastException stating that the Windows LAF cannot be typecast to the Nimbus LAF). I did a little debugging, and the source of the error seems to be because the Movie Maker's init() method is not called from the EDT, even though it extends the JFrame class (as a result of which lots of operations in init() need to be specifically done on the EDT, I think). Could you please let me know if my line of reasoning is correct? If so, shall I submit a PR that fixes this first?

  7. github-actions commented on Jul 15, 2026

    @github-actions

    This issue has been automatically closed and locked.

    Processing 3.x is no longer actively developed. Since January 2020, development moved to the Processing 4 repository.

    If this issue is still relevant to Processing 4, we'd love to hear from you. Please open a new issue at:
    https://github.com/processing/processing4/issues/new/choose

    Thank you for helping improve Processing.

  8. locked as resolved and limited conversation to collaborators on Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions