Performance best practices for Jetpack Compose

Поділитися
Вставка
  • Опубліковано 22 лип 2024
  • Jetpack Compose can feel like magic, but what do you do when the magic isn't as performant as you want? Discover best practices in Jetpack Compose with regards to performance, common mistakes, and how to avoid them.
    Resources:
    JetPack Compose Performance → goo.gle/3r4gGtJ
    Baseline Profiles → goo.gle/3r5aqC1
    Jetpack Compose Phases → goo.gle/3uQfA5C
    Speakers: Chuck Jazdzewski, Ben Trengrove
    Watch more:
    All Google I/O 2022 Sessions → goo.gle/IO22_AllSessions
    Android and Play at Google I/O 2022 playlist → goo.gle/IO22_AndroidDevs
    All Google I/O 2022 technical sessions → goo.gle/IO22_Sessions
    Subscribe to Android Developers → goo.gle/AndroidDevs
    #GoogleIO #Featured #JetpackCompose
  • Наука та технологія

КОМЕНТАРІ • 59

  • @kenbX
    @kenbX 2 роки тому +13

    Legends say that even to this day, Chuck is still waving to you.
    On a more serious note, great content, it was very helpful!

    • @AndroidDevelopers
      @AndroidDevelopers  Рік тому

      We're delighted that the tutorial was helpful to you, Ken! You can check out the Android Basics with Compose course here for even more Jetpack Compose fun: goo.gle/3V7Vlgg

  • @carapas_
    @carapas_ Рік тому +15

    Very usefull video. Coming back here to watch some tricks again and again, so I decided to write some timecodes to help myself and maybe some of you too:
    1:00 - Configuration
    1:55 - Something to remember
    3:57 - LazyList Key
    5:47 - derivedStateOf
    8:10 - Compose primary phases
    9:57 - defer reading state
    11:36 - Running backwards (Backwards write)
    15:26 - Covering your bases (Baseline profiles)

  • @hocinehope8880
    @hocinehope8880 Рік тому +1

    Thank you for this video and to the dev team, keep going, you are on the good way !

  • @jaya-surya-t
    @jaya-surya-t 2 роки тому +3

    This is a very helpful video for compose optimizations, appreciate it.

  • @paulroos8517
    @paulroos8517 9 місяців тому

    More of this, please. Something I have learned is one learns quite a lot about a new language/platform when one programs for performance.

  • @tomcully
    @tomcully 2 роки тому +6

    This is really useful. Thanks!

  • @nikolayrogchev9628
    @nikolayrogchev9628 Рік тому

    Amazing, short and on the point, keep up the good work

  • @IncompleteTheory
    @IncompleteTheory 2 роки тому +48

    More of this! This is extremely helpful. Personally I'd like more tips on to spot and avoid unnecessary recompositions.

    • @robchr
      @robchr 2 роки тому +4

      I recommend looking at "composable metrics". Chris Banes has a blog post on it. It will generate a report on all your composable functions. Composable metrics tells you if a composable function is restartable and skippable. And if Compose can infer if an object is stable or immutable.

    • @IncompleteTheory
      @IncompleteTheory 2 роки тому

      @@robchr Cheers for that pointer, this looks very interesting indeed.

    • @ketutsueca7535
      @ketutsueca7535 2 роки тому

      🎊🎊🎊😣😣😣🎊🎊😣🎊😣😣🎊😣😣😣😣😣😣😣😣😣😣😣🎊🎊😣🎊😣🎊🎊🎊😣🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊😢😢🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊🎊😢😢😢😢😢😢😢😢😢😢😢😢😢😢😢😢😢😢😢😢😢😢😢😢😢😢😢😢😢😢😢

    • @annacarolinasouza8693
      @annacarolinasouza8693 2 роки тому

      @@robchr ⁹

    • @kasnadiwicaksono9292
      @kasnadiwicaksono9292 2 роки тому

      @@robchr🐶🐶🐩🐩😃😃😃;-):-C-);-) bjjjjjcvbbvvvnjo🐶🐶🐶🐶🐶🐶🐶🐶🐶🐶

  • @user-tt8zv7uf4q
    @user-tt8zv7uf4q 2 роки тому +3

    Very useful information!🙏🙏

  • @theapache64
    @theapache64 Рік тому +1

    Thank you so much for this video! Enjoyed to the max

    • @AndroidDevelopers
      @AndroidDevelopers  Рік тому

      We're delighted to hear that you've enjoyed the tutorial. If you'd like to learn more about Jetpack Compose, please check out this resource: goo.gle/compose-pathway 🤩

  • @VirgilioSolano
    @VirgilioSolano Рік тому

    The most completely class about compose tricks... thank you so much :)

  • @Mrdresden
    @Mrdresden 2 роки тому +1

    Great content! While watching this I was litterally dealing with startup jank, that is probably now just the JIT.

  • @isaissb
    @isaissb 2 роки тому +1

    Thank you for the Summary at the end.

  • @anudeepananth
    @anudeepananth 2 роки тому

    So the macrobenchmark library let's us see what the improvements might be for the user in the release build but does not guarantee it? And also we do not need to do anything to ensure baseline profiles are added to the app, it's added by default. Is that right?

  • @esfandune_ir
    @esfandune_ir 2 роки тому +1

    This is very useful. Thanks!

    • @AndroidDevelopers
      @AndroidDevelopers  2 роки тому

      Appreciate the feedback, Abbasali! Don't forget to subscribe for more 😎👍

  • @Maksim-8292
    @Maksim-8292 9 місяців тому

    4:14 if item 5 and 4 are swapped, then only they should be recomposed, right? Items 1, 2,3, 6, 7 and subsequent items will keep their indexes which are used as keys. Do we need a LazyList Key in this case?

  • @CommanderSteps
    @CommanderSteps 2 роки тому +1

    This helps a lot!

    • @AndroidDevelopers
      @AndroidDevelopers  Рік тому +1

      Happy to hear the tutorial was helpful, Stefan! If you’re interested in additional resources, check out the Jetpack Compose walkthrough here: goo.gle/3p7WO7l

  • @oguzhanaslan494
    @oguzhanaslan494 2 роки тому +1

    Great Presentation !!

    • @AndroidDevelopers
      @AndroidDevelopers  Рік тому

      We really appreciate your support! Thanks for watching 🙂

  • @GakisStylianos
    @GakisStylianos 2 роки тому

    This was a really information dense video! But very well presented nonetheless

  • @FreedivingTrainer
    @FreedivingTrainer 2 роки тому

    If I use Canvas(modifier = ..) in Compose and pass value which frequently changes, should I use drawBehind method? And how? Put Canvas in this method?

    • @TheAndreArtus
      @TheAndreArtus 2 роки тому

      Depends on what you want it to change. If you are adding or removing sub-composables, or changing the size or layout then recomposition or layout will be triggered. In the case of the example only the color changed, everything else remained the same, so it only affected how the background was drawn (the function of drawBehind).
      Other functions, e.g. drawWithCache or drawWithContent, may be better suited to what you need.
      A good question to ask may be why the value frequently changes. E.g. a clock implementation may only need to redraw some aspects (text/hands) and the rest (ticks/frame/etc.) may be subject to caching.

  • @gabdrn
    @gabdrn 2 роки тому

    Simply awesome

  • @mohammadcs5708
    @mohammadcs5708 2 роки тому +1

    Great

    • @AndroidDevelopers
      @AndroidDevelopers  Рік тому

      Thanks so much, Mohammad! Since you liked this video, come check out our Jetpack Compose playlist for more on this topic 😊

  • @arjunbhat6502
    @arjunbhat6502 2 роки тому +1

    We want more of this from Engineers from inside.

  • @minasmina2700
    @minasmina2700 2 роки тому +3

    Is this information available in a blog post or in the compose documentation?

    • @AndroidDevelopers
      @AndroidDevelopers  2 роки тому +3

      Indeed it is! You can find the additional resources for this lesson here:
      JetPack Compose Performance → bit.ly/3xNSSwI
      Baseline Profiles → bit.ly/3tUmF5G
      Jetpack Compose Phases → bit.ly/39HNK5k

  • @jasvirsinghjasvirsingh9765
    @jasvirsinghjasvirsingh9765 Рік тому

    Good moreng

  • @Daaaaaaavid
    @Daaaaaaavid 2 роки тому +5

    The uggliest thing about Compose and which applies to each new stuff is when it allows you to do something which is not recommended to do.

  • @xpopcornx1747
    @xpopcornx1747 2 роки тому

    Do you really need R8 enabled? Will Compose be slower without it than the xml view system?

    • @GakisStylianos
      @GakisStylianos 2 роки тому

      Yes but you wouldn't ship your app without R8 in any case. For local development it's not such a huge deal

  • @hardlife507
    @hardlife507 Рік тому +1

    This is good stuff. I owe you guys some ☕

    • @AndroidDevelopers
      @AndroidDevelopers  Рік тому

      Thanks for the coffee, Jerry! Have you checked out our Jetpack Compose walkthrough? You can learn more here: goo.gle/3MK5Xhy ☕

  • @user-ho9pl2qd2d
    @user-ho9pl2qd2d 2 роки тому

    hi Ben and Chuck!

  • @dev_jeongdaeri
    @dev_jeongdaeri 2 роки тому

    Wow

  • @nouwat
    @nouwat 8 днів тому

    Nice❤ 0:53

  • @nayandhabarde
    @nayandhabarde 2 роки тому

    Why was this not highlighted in first place

  • @dimidbrodsky9523
    @dimidbrodsky9523 2 роки тому

    How can i to hide a top bar(scaffold)? in specific screens

    • @dimidbrodsky9523
      @dimidbrodsky9523 2 роки тому

      it destroyed my brain !

    • @dimidbrodsky9523
      @dimidbrodsky9523 2 роки тому

      PLZ show a beautiful solution!

    • @AndroidDevelopers
      @AndroidDevelopers  2 роки тому +1

      Hello Dimid, please check here for more information regarding Material Components and layouts in Jetpack Compose: goo.gle/3IEPp8K

  • @mondoshigua
    @mondoshigua Рік тому

    🙌🏻🇨🇴🧔🏻👍🏼🤝🏼 Saludos desde Colombia.

  • @tyronecarpenter3971
    @tyronecarpenter3971 11 місяців тому

    0:48

  • @farazahmed7
    @farazahmed7 2 роки тому

    poor Chuck

  • @5erTurbo
    @5erTurbo 2 роки тому +2

    Please don't make presentation code dark them and other stuff light theme