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

Slow loading of string resource at first open of screen #708

Closed
Alex009 opened this issue May 16, 2024 · 6 comments · Fixed by #715
Closed

Slow loading of string resource at first open of screen #708

Alex009 opened this issue May 16, 2024 · 6 comments · Fixed by #715
Assignees
Milestone

Comments

@Alex009
Copy link
Member

Alex009 commented May 16, 2024

ios-cocoapods-static-framework.7z.zip

Kapture.2024-05-09.at.14.21.23.mp4

This is my modification based on your demo, and you can see that there is indeed a delayed response for moko to load.

The first time the app is run, there is a delayed response for moko loading, and it is normal to repeat the operation later.

Originally posted by @syxc in #625 (reply in thread)

@Alex009 Alex009 added this to the 0.24.0 milestone May 16, 2024
@Alex009
Copy link
Member Author

Alex009 commented May 16, 2024

#625 (reply in thread) another demonstration

@ExNDY
Copy link
Contributor

ExNDY commented May 19, 2024

fun localizedString(stringRes: StringResource): String {
        val bundle = StringDesc.localeType.getLocaleBundle(stringRes.bundle) <-- Here
        val string = bundle.localizedStringForKey(stringRes.resourceId, null, null)
        return if (string == stringRes.resourceId) {
            stringRes.bundle.localizedStringForKey(stringRes.resourceId, null, null)
        } else string
    }

I'm do little research and without bundle we have normal performance.

@syxc
Copy link

syxc commented May 19, 2024

fun localizedString(stringRes: StringResource): String {
        val bundle = StringDesc.localeType.getLocaleBundle(stringRes.bundle) <-- Here
        val string = bundle.localizedStringForKey(stringRes.resourceId, null, null)
        return if (string == stringRes.resourceId) {
            stringRes.bundle.localizedStringForKey(stringRes.resourceId, null, null)
        } else string
    }

I'm do little research and without bundle we have normal performance.

ios-cocoapods-static-framework.7z.zip

You can take a look at the demo. You can actually see a slight loading delay in moko loading. This demo is your official example. Based on this, I added two new pages to simulate actual application scenarios. Other places No modifications were made.
In fact, I am also very surprised as to why this happens.

@ExNDY
Copy link
Contributor

ExNDY commented May 19, 2024

@syxc

You can take a look at the demo.

I'm don't say "problem not found", but now i think problem with first replacement bundle content in RAM. Don't know, need research

@syxc
Copy link

syxc commented May 19, 2024

@syxc

You can take a look at the demo.

I'm don't say "problem not found", but now i think problem with first replacement bundle content in RAM. Don't know, need research

@ExNDY
Understood. Thanks a lot!

ExNDY added a commit that referenced this issue May 20, 2024
ExNDY added a commit that referenced this issue May 20, 2024
@ExNDY ExNDY linked a pull request May 20, 2024 that will close this issue
Alex009 added a commit that referenced this issue May 21, 2024
…esources-ios

#708 slow first time use of resources ios
@Alex009
Copy link
Member Author

Alex009 commented May 21, 2024

fix will be available in 0.24.0-beta-5

@Alex009 Alex009 closed this as completed May 21, 2024
@Alex009 Alex009 mentioned this issue Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants