GithubHelp home page GithubHelp logo

Comments (15)

mikepenz avatar mikepenz commented on June 17, 2024 1

While Library couldn't be marked as Stable, there's now a new extension function which wraps the Library into an value class marked as Immutable:

https://github.com/mikepenz/AboutLibraries/pull/906/files#diff-c6dbf278529759cc4388375a78a41da6646173cf61895a7117d6a75dda58f46fR9-R15

Overall the compose code was re-worked to be more efficient through the above too.

from aboutlibraries.

mikepenz avatar mikepenz commented on June 17, 2024 1

If only the official one was available for multiplatform projects 🙃 .

And unfortunately the awesome temporary one from Skydoves doesn't yet seem to support wasm: https://github.com/skydoves/compose-stable-marker

from aboutlibraries.

mikepenz avatar mikepenz commented on June 17, 2024 1

I have now added a stability config file to the core module which is applied to the m2 and m3 modules.
https://github.com/mikepenz/AboutLibraries/pull/947/files#diff-712ed77459cddd5330863385aafe9b2ac858c77264e835c5a72dec5d292692ec

https://github.com/mikepenz/AboutLibraries/pull/947/files#diff-b652902b5629ab239e12e0496a86224dfaaf82622c8bd7163cd329d5ae1a4df8R56

As described here:
https://developer.android.com/jetpack/compose/performance/stability/fix#configuration-file

for the m2/m3 modules the stability looks good now.

from aboutlibraries.

mikepenz avatar mikepenz commented on June 17, 2024

Thank you very much for the suggestion. I will have a closer look into that.

Most likely the @Stable will be the choice, until all required targets are supported

from aboutlibraries.

mikepenz avatar mikepenz commented on June 17, 2024

Upon further investigation, the @Stable nor the @Immutable annotations can be added to the Library class, as those are part of the compose-runtime, however the core module of AboutLibraries does not have dependencies on compose.

Looking for answers, I could not find a proper solution other than adding compose to core which is not anticipated.

Open for other solutions.

from aboutlibraries.

Nailik avatar Nailik commented on June 17, 2024

I also recently found out that @Stable is compose only. But data classes should be recognized by compose as stable when they are stable.
So checking that all variables are val and all lists are ImmutableList it shoud work. Also as far as i know the immutable library https://github.com/Kotlin/kotlinx.collections.immutable requires only kotlin and not compose so i should work.

from aboutlibraries.

mikepenz avatar mikepenz commented on June 17, 2024

However as you noted the immutable project does not support all the architecture targets this project offers. Until this is the case, it cannot be fixed within the core library unfortunately.

from aboutlibraries.

Nailik avatar Nailik commented on June 17, 2024

Nice thank you @mikepenz that's pretty much how i solved it currently.

BTW there seems to be an open PR from a guy at Jetbrains that would solve the issue by adding the remaining targets Kotlin/kotlinx.collections.immutable#148

from aboutlibraries.

Nailik avatar Nailik commented on June 17, 2024

With kotlinx.collections.immutable 3.6.0 there is now finally support for all architectures and i think this could now be reopened and worked on

from aboutlibraries.

mikepenz avatar mikepenz commented on June 17, 2024

Thank you for the update here.

from aboutlibraries.

mikepenz avatar mikepenz commented on June 17, 2024

Started working on this. However something strange is happening, which I don't understand yet:

Screenshot 2024-01-06 at 10 41 36

the Library class will not have a clear runtime stability even though as all of it is stable.

Screenshot 2024-01-06 at 10 42 11

Resulting in the Libs class being unstable.

Screenshot 2024-01-06 at 10 44 06

from aboutlibraries.

Nailik avatar Nailik commented on June 17, 2024

Maybe you could use the @Stable annotation on the Library to tell the compiler that it has runtime stability?

from aboutlibraries.

Nailik avatar Nailik commented on June 17, 2024

I opened a post in the kotlin slack maybe they can help https://kotlinlang.slack.com/archives/C3PQML5NU/p1704560437578069

from aboutlibraries.

MV-GH avatar MV-GH commented on June 17, 2024

Did you ran it from a clean build to generate the compose compiler metrics? There was a bug where in incremental compilation it would incorrectly infer stability. Can't seem to find the exact issue at hand though.

from aboutlibraries.

mikepenz avatar mikepenz commented on June 17, 2024

@MV-GH yes I tried it on clean builds too. Unfortunately, it still resulted in these strange results

./gradlew clean aboutlibraries-core:assembleRelease -PcomposeCompilerReports=true 

Using this branch (added compose compiler to the core module to run the report): https://github.com/mikepenz/AboutLibraries/tree/test/compose_compiler_core

It's worth noting that I observed inconsistencies between reports (when I was testing different things) - and yes I can confirm that incremental builds made things very inconsistent :D.

Thank you so much @MV-GH for also looking into it

from aboutlibraries.

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.