powerhouse-inc / connect

https://document-model-electron.vercel.app
3 stars 2 forks source link

357 improve folderview performance #374

Closed gpuente closed 1 month ago

gpuente commented 1 month ago

Description:

NOTE: Virtualization will be added in a different PR

vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
connect ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 14, 2024 0:56am
gpuente commented 1 month ago

Do you know what is taking the longest now?

I noticed that the console.log call for the PressResponder warning hits performance a bit. A PressResponder was rendered without a pressable child. Either call the usePress hook, or wrap your DOM node with <Pressable> component.

Also decodeId and encodeId look like they could be optimized a bit. The string is iterated once for each character we want to replace, maybe we could replace everything in a single call.

export const encodeID = (id: string) => {
    let encodedID = id;

    replacements.forEach(({ encode }) => {
        const [regexp, replaceWith] = encode;
        encodedID = encodedID.replace(regexp, replaceWith);
    });

    return encodedID;
};

FolderView still takes most of the render time, but this is going to be fixed with the implementation of virtualization (working on it rn)

Screenshot 2024-06-14 at 12 11 21 PM

I'll address the encodeID, decodeID and PressResponder performance optimizations in a different PR 👍🏻

github-actions[bot] commented 1 month ago

:tada: This PR is included in version 1.0.0-dev.7 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

github-actions[bot] commented 1 month ago

:tada: This PR is included in version 1.0.0-next.2 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: