Git Product home page Git Product logo

Comments (9)

ExNDY avatar ExNDY commented on July 24, 2024

Try to use:
https://github.com/Kotlin/kotlinx.collections.immutable
map is not Immutable type, i think on android you doesn't have problem because in latest versions of jetpack compose has optimisations with copy this library under hood(or you have problem on android, but don't see it). My opinion you should use persistentMapOf, not simple map.

from moko-resources.

nibblis avatar nibblis commented on July 24, 2024

@ExNDY, it's the same with persistentMapOf
according to the profiler in android, the memory usage does not exceed 160 MB
2024-05-20

from moko-resources.

ExNDY avatar ExNDY commented on July 24, 2024

Ios != Android,
for android used jetpack compose, for ios jetbrains solution. U should think about recomposition and ios platform is sensitive for this.
Please try on ios and say your result

from moko-resources.

nibblis avatar nibblis commented on July 24, 2024

not sure what exactly you mean by recomposition

i tried copying the fontFamilyResource code to my project: removed @Composable and remember, made the fonts a constant. after that, memory consumption does not exceed 200 MB

i don't think the problem is with the moko-resources library

val montserratFontFamilyMap: Map<Montserrat, FontFamily> by lazy {
    mapOf(
    Montserrat.Black to fontFamilyResource(MR.fonts.montserrat_black.montserrat_black),
    Montserrat.Light to fontFamilyResource(MR.fonts.montserrat_light.montserrat_light),
    Montserrat.Bold to fontFamilyResource(MR.fonts.montserrat_bold.montserrat_bold),
    ...
    )
)

from moko-resources.

ExNDY avatar ExNDY commented on July 24, 2024

i don't cleary understand you, you find problem with your logic on ui? or what's happined? Recomposition for me is base of compose:) If you use unstable types inside composition on every recomposition of screen (recreating/update screen content you create new values for unstable variable) because one of solution for best performance don't usage of list for remember, for example.
Because i'm question for you, about usage in yours code unstable map.
If your problem is solved - is cool.

from moko-resources.

nibblis avatar nibblis commented on July 24, 2024

i haven't solved the problem, most likely it's because of remember and how it's implemented for ios

if you think i'm using unstable types, then why isn't there this problem on android?

from moko-resources.

ExNDY avatar ExNDY commented on July 24, 2024

you read my first message? Android has optimisations under hood. How much experience you have in compose? I need understand what i can do for this issue

from moko-resources.

nibblis avatar nibblis commented on July 24, 2024

yes, i saw the message. but your assumption that android has optimization under the hood doesn't seem convincing. simply removing remember eliminates the problem

fonts don't depend on the ui state. is it possible to make fontFamilyResource not @Composable?

from moko-resources.

ExNDY avatar ExNDY commented on July 24, 2024

Hm, man, you "rewrite" on non compose style. You don't hear important argument: jetpack compose is not compose Multiplatform on other platforms, that framework very sensitive for data types. Usage of lazy inside Composable talking about you don't know principles of Compose. Sorry, i'm question you about your experience in Compose for that. You ignore me with this question. Question about persistentMapOf on ios was ignored too. If somebody wants chat with you that's cool.

from moko-resources.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.