Single Line React Performance Boost with Million

Поделиться
HTML-код
  • Опубликовано: 22 окт 2024

Комментарии • 67

  • @hpn1427
    @hpn1427 Год назад +34

    Thank you for the amazing content you are publishing very often Jack, you are top 1 content creator in the world for React/Next and all things Javascript/Typescript related. One big thank you from the developers all around the world. You make a huge impact on our careers and I am forever grateful

  • @ikirandash
    @ikirandash Год назад +6

    This is amazing content. Thanks for sharing the stuff that’s unknown to most engineers. Really helpful too 🙏🏻

  • @haack79
    @haack79 Год назад +2

    yayyy so glad to see this , just what I was asking for =)

  • @dominicanfrankster
    @dominicanfrankster Год назад +4

    Mmm. I'm a Solid fanboy, so I didn't see a need for this until you said "surgical implementation." Going to try this out.

  • @maltegb
    @maltegb Год назад +1

    We need some merch with the slogans from the intro!

  • @andrewc8125
    @andrewc8125 Год назад +2

    Thank you for the amazing content as always! 🎉

  • @balubalaji9956
    @balubalaji9956 Год назад +2

    I heard good things about million. Now i experienced it.

  • @Dev-Siri
    @Dev-Siri Год назад +5

    Million is a nice tool ngl but I think some people are now gonna use it in places where it doesn't need to be (or otherwise premature over-optimization).
    I think your tips for choosing it are good one.
    - React perf
    - Then million
    - Full rewrite to Svelte/Solid/Qwik/Preact
    Unfortunately I left React before even knowing million existed && now I am stuck in Svelte land.

  • @Nicky-dw2eu
    @Nicky-dw2eu Год назад +3

    I wish you gave more details about how Million achieves this performance boost. I think the first step you mentionned at the end is crucial, using React profiler and understanding the root cause of the slowness. I’m afraid junior devs will directly jump in to step 2 and try Million without fixing the actual root cause, kind of like devs using ChatGPT without understanding what it outputs. Also step 3 shouldn’t be an advice in my opinion… it should never happen that you need to drop React because of performance.

    • @MrEnsiferum77
      @MrEnsiferum77 Год назад

      In codebase where the component is 1500 lines of code, some old developer write some code without tests I will jump straight to million... I drop React because is crap, and in every next project I will have the chance, I will replace react without thinking...

  • @wesleyjanse6600
    @wesleyjanse6600 Год назад +1

    Offtopic: is there a video on which zsh terminal/theme you are using?

  • @ivankuryukin2494
    @ivankuryukin2494 Год назад +1

    I feel mischievous watching such content 😂😂😂

  • @thesobercoder
    @thesobercoder Год назад

    Fell in love with your prompt 😂. Mind sharing that fancy arrow. I couldn’t find that anywhere.

    • @jherr
      @jherr  Год назад

      It's the "atomic" prompt from oh-my-posh.

  • @runonce
    @runonce Год назад +2

    Nice vid, thanks! Any tradeoffs we should be aweare when using Million?

    • @jherr
      @jherr  Год назад +2

      There are some documented rules around the blocks and what you can and can't do with them in the documetation.

  • @VictorMongi
    @VictorMongi Год назад

    Hello Jack what zsh theme is that? Thank you, love all your vids anyway…

  • @zootlol
    @zootlol Год назад

    What zsh theme do you use? I thought it was powerlevel10k for a second but it looks a tiny bit different

    • @jherr
      @jherr  Год назад +1

      Currently it's "atomic"

  • @somashekarbr3597
    @somashekarbr3597 Год назад +2

    your amazing
    right on point

  • @FunctionGermany
    @FunctionGermany Год назад +1

    did you mention that it doesn't work with component libraries? makes it DOA in my opinion.

  • @kengreeff
    @kengreeff Год назад

    Hey jack! Great video, thank you. Was wondering how you were doing the code highlighting/dimming the code around the block you are taking about, really cool effect!

    • @christerjohanzzon
      @christerjohanzzon Год назад +1

      It's a post editing filter. These aren't done live, but in editing before publishing. There are a number of ways to do that.

    • @jherr
      @jherr  Год назад

      Yep. I use screenflow and the fact that I use a pure black background makes it a lot easier to highlight the code fragments.

  • @the_wrong_folder
    @the_wrong_folder Год назад

    just curious - Do you have any full React-project-based courses? Can you include links to those in your descriptions? Awesome channel btw!

    • @jherr
      @jherr  Год назад

      I have a full learning React playlist, check the channel page under playlists.

  • @miGuHD
    @miGuHD Год назад

    Thanks for the video Jack, interesting introduction to Million. However in your outro you only suggest a "roadmap" for sort of alternatives to simply use Million pretty much everywhere. Are there cases where adding Million creates more issues than it solves?

    • @jherr
      @jherr  Год назад +3

      I think if you follow the rules you should be pretty good. That being said, this is definitely hacking on the React side. So... if you don't really need it, then I wouldn't use it.

  • @svahdati
    @svahdati Год назад

    Hello Jack, thanks for your great content, it's so helpful, what is your zsh theme name?

  • @b29gupta
    @b29gupta Год назад

    Hi! @jack
    Always great to see your content. Very helpful and insightful a lot of times.
    Can you please make a video on best practices for using gravity type animations in react for html components (div/box etc...)?

    • @jherr
      @jherr  Год назад

      You mean physics based animations?

  • @rishrathore1613
    @rishrathore1613 Год назад +2

    That actually makes us question, why even use React if it's virtual DOM is the biggest hurdle in performance?

    • @jherr
      @jherr  Год назад +3

      React's ecosystem is still second to none. And for more IRL applications the VDOM performance is just fine. It's pretty fun to play around with speeding it up, but 1,440 divs rolling at 60 FPS is cool, but not something most folks need every day.

    • @XavierGoncalves89
      @XavierGoncalves89 Год назад +6

      @@jherr Taking what Jack said, if you are rendering 1440 divs in your app all at the same time, you have a product design issue, not a React issue

  • @sanjarcode
    @sanjarcode Год назад

    Just one question Jack, is the React virtual DOM (structure + algorithm) just about the node/tree optimization, or is there more to it? ChatGPT tells me that React does consider the details of the UI and CSS into account, which I think is wrong.

    • @jherr
      @jherr  Год назад +1

      Linters take the details of the UI and CSS into account, for example, applying alt tags to images. But the core React library is simply about node/tree management, as you say. That's why it works for both React and React-Native, as well as all the side projects folks have thrown it on.

  • @CoryTheSimmons
    @CoryTheSimmons Год назад

    They should wrap JS in Million. :O

  • @feldinho
    @feldinho Год назад

    Is that a new intro? "Make it work, then make it beautiful" is my motto since I became a lead developer, but I have no idea where I got it from…

    • @jherr
      @jherr  Год назад +1

      Yeah! That’s our new intro and we’ll be doing some swag and what not with it. It’s a good motto and it captures the essence of what we’re trying to do with the channel; practical advice for working devs.

  • @randomforest_dev
    @randomforest_dev Год назад

    Since react is recommending nextjs and remix as default frameworks, I wonder if million can be used inside these frameworks.

  • @Fullflexno
    @Fullflexno Год назад

    My dude! Cool!

  • @WhiteSponge
    @WhiteSponge Год назад +1

    Yea pretty obvious that the For syntax takes inspiration from SolidJS lol but SolidJS is still better with how its components doesnt re-run

  • @MrPlaiedes
    @MrPlaiedes Год назад

    It's like doing a bunch of coke and then saying Look how fast I work!

  • @StingSting844
    @StingSting844 Год назад +4

    I hope people understand that React is not a silver bullet and that it's okay. A lot of them defend React until their last breath using anecdotes and it's frustrating to see the lack of understanding of the fundamental model of React. There's a reason why they had to introduce time slicing and rewrite to a 'fiber' architecture

  • @sck3570
    @sck3570 Год назад

    does he edit the video himself? the editing/effects are so good

    • @jherr
      @jherr  Год назад +2

      I didn't edit the sting section (the Make It Work, Good, Fast, logo section) but the rest I edited, yeah. Thanks!

  • @danteDeveloper
    @danteDeveloper Год назад

    Sir, thank you for your all effort and contents. Mind if I introduce your million rainbow projects to my Korean viewer in my video?

    • @jherr
      @jherr  Год назад

      Go for it!

  • @SanthoshRaghav-m1x
    @SanthoshRaghav-m1x Год назад +1

    Font family name used in the vscode please?

    • @jherr
      @jherr  Год назад +3

      JETBrains Mono

  • @AshutoshKumar-ue3dr
    @AshutoshKumar-ue3dr Год назад

    What do you think about Million JS with React Native?

    • @jherr
      @jherr  Год назад +1

      Haven't tried it. Though I think it might be hard-wired to the web DOM.

    • @binitrupakheti4246
      @binitrupakheti4246 Год назад +1

      No need because UI already runs on native thread. The bottleneck is the JS bridge and JS thread. The thread is being rewritten in C++ in the new architecture.

  • @viktor-dy9tr
    @viktor-dy9tr Год назад

    Is it possible to wrap the main App and million everything?

    • @backupmemories897
      @backupmemories897 8 месяцев назад +1

      latest million can do better u just do auto: true on the config and it auto put million every single one xD but make sure u use 2.6.4 not 3.x because 3.0.2 will throw an error. its not stable yet.

  • @buzzer79
    @buzzer79 Год назад

    why you are not using canvas?

    • @jherr
      @jherr  Год назад

      That wouldn’t demonstrate million because canvas is just a single tag.

  • @taimoorsheikh5001
    @taimoorsheikh5001 Год назад

    Have they altered the current VDOM react implementation?

    • @jherr
      @jherr  Год назад +2

      They've replaced it within the context of the block. So the app remains a React application, the top level component is rendered using the VDOM. But the component that renders the rainbow divs is managed by Millions block renderer.

    • @taimoorsheikh5001
      @taimoorsheikh5001 Год назад

      @@jherr Got it. What's the strategy this block renderer is using?

    • @jherr
      @jherr  Год назад +2

      @@taimoorsheikh5001 As mentioned and shown in the video there is a documentation section on the Million site million.dev/docs/quickstart#hitting-the-limit that covers the basics of the block rendering approach.

    • @taimoorsheikh5001
      @taimoorsheikh5001 Год назад

      @@jherr Thanks again :)

  • @dennydharmawan4820
    @dennydharmawan4820 Год назад

    Dang how do you even discover stuff like this by yourself?

  • @shayanCodingMaster
    @shayanCodingMaster Год назад

    How can I install oha in windows 10

  • @Dylan_thebrand_slayer_Mulveiny
    @Dylan_thebrand_slayer_Mulveiny Год назад +1

    If you need a solution like this, you 100% need to rethink how you've structured your project. Adding million means another layer of abstraction. That means your components are now more complex, and you've also got hidden edge cases introduced by million that you'll have to debug. All of that makes bug tracing exponentially more difficult. It's also going to mean migrating your components to another framework, or even a new version of React more difficult.
    Overall, I'd say that this is a TERRIBLE idea. The fact you don't see this being needed in other frameworks like Svelte or VUE says a LOT about how bad React actually is.

  • @avneet12284
    @avneet12284 Год назад +1

    I'd probably try a useLayoutEffect instead of useEffect. Excellent regardless

    • @jherr
      @jherr  Год назад

      It only gets run the once, but, sure, that one run of the effect callback would be called slightly more quickly with a layout effect. :)