镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

🐞 Folder opening time #395

Closed
Closed

Description

@Angelk90

Description

I created a simple empty project, but with a fairly thoughtful node_modules folder, not too much.

As you can see from the video, it takes about 40 seconds to open the second folder.

The same operation was done with Webstorm, the time taken was about 5 seconds.

To Reproduce

CodeEdit:

Registrazione.schermo.2022-04-04.alle.12.48.32.mov

Webstorm:

Registrazione.schermo.2022-04-04.alle.13.11.32.mov

Expected behavior

  • Try to reduce opening times.
  • Give visual feedback that the folder is about to open, like webstorm does, using loading.

Version information

CodeEdit: 1.0 (1)
Commit: ee93d1e
MacOS: 12.3 (21E230)
Xcode: 13.3 (13E113)

Additional context

Link project: https://codesandbox.io/s/kind-cray-y09kuj?file=/package.json

Activity

  1. 0xWDG commented on Apr 4, 2022

    @0xWDG
    Collaborator

    Related to #20, #21, #25, #45 and #61.
    This is a difficult issue.

  2. lukepistrol commented on Apr 4, 2022

    @lukepistrol
    Member

    Just a thought:
    What if we don't use structs with child/parent properties for fast access but instead use a dictionary of some sort (or any other hash table structure) to reach O(1) instead of recursively iterating over the children?

  3. Angelk90 commented on Apr 4, 2022

    @Angelk90
    ContributorAuthor

    @wdg : Sooner or later you have to face it as a problem.

  4. 0xWDG commented on Apr 4, 2022

    @0xWDG
    Collaborator

    @wdg : Sooner or later you have to face it as a problem.

    No one said we must not face the problem, but the thing is a lot of people already have searched for a solution, but sadly we didn't found a solution yet.

  5. 0xWDG commented on Apr 5, 2022

    @0xWDG
    Collaborator

    We should find a way to load this in the background, and return it to the main thread to update the UI.
    if you open a file, the whole sidebar gets reloaded again (this should be prevented).

    /// A `DisclosureGroup` representing a folder.
    ///
    /// When expanded, it shows files/folders inside
    @ViewBuilder
    private func sidebarFolderItem(_ item: WorkspaceClient.FileItem) -> some View {
    DisclosureGroup(isExpanded: $isExpanded) {
    if shouldloadChildren { // Only load when parent is expanded -> Improves performance massively
    ForEach(item.children!.sortItems(foldersOnTop: workspace.sortFoldersOnTop)) { child in
    ProjectNavigatorItem(
    item: child,
    workspace: workspace,
    windowController: windowController,
    shouldloadChildren: $isExpanded,
    selectedId: $selectedId
    )
    }
    }
    } label: {
    Label(item.url.lastPathComponent, systemImage: item.systemImage)
    .accentColor(.secondary)
    .contextMenu {
    ProjectNavigatorContextMenu(item, isFolder: true)
    }
    }
    }

  6. RayZhao1998 commented on Apr 5, 2022

    @RayZhao1998
    Collaborator

    I think it's because of SwiftUI List's bad performance. It's based on NSTableView.

    According to Instruments, the time-consuming operation is calculating the row item's height. While List has no functions like tableView(_:heightOfRow:).

    截屏2022-04-05 4 44 09 PM

  7. lukepistrol commented on Apr 5, 2022

    @lukepistrol
    Member

    @Angelk90 Can you share the project or a similar sized one you were using in your tests?

  8. Angelk90 commented on Apr 5, 2022

    @Angelk90
    ContributorAuthor

    @RayZhao1998 : Do you have any possible solution in mind?

  9. lukepistrol commented on Apr 5, 2022

    @lukepistrol
    Member

    I think it's because of SwiftUI List's bad performance. It's based on NSTableView.

    According to Instruments, the time-consuming operation is calculating the row item's height. While List has no functions like tableView(_:heightOfRow:).

    Found an article that mentions the same issue: https://kean.blog/post/not-list

    Maybe we need to implement NSTableView ourselves.

  10. Angelk90 commented on Apr 5, 2022

    @Angelk90
    ContributorAuthor

    @lukepistrol : Find the link above, in Additional context just download the project and install the node_modules.

  11. lukepistrol commented on Apr 6, 2022

    @lukepistrol
    Member

    Using NSOutlineView wrapped in NSViewControllerRepresentable. Still WIP but performance is great!

    Screen.Recording.2022-04-06.at.12.24.30.mov
  12. self-assigned this
    on Apr 6, 2022
  13. lukepistrol commented on Apr 6, 2022

    @lukepistrol
    Member

    Added a draft PR #411

  14. moved this from 🆕 New to 🏁 Complete in CodeEdit Projecton Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

WIPThis is work-in-progressbugSomething isn't workingperformanceThis is performance related

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions