Single Line React Performance Boost with Million

Поділитися
Вставка
  • Опубліковано 11 вер 2024
  • Turbo charge your React application with the new block rendering engine in Million.
    Upcoming NextJS course: pronextjs.dev
    Code: github.com/jhe...
    Liminal: www.liminal.sh/

КОМЕНТАРІ • 68

  • @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 🙏🏻

  • @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.

  • @haack79
    @haack79 Рік тому +2

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

  • @andrewc8125
    @andrewc8125 Рік тому +2

    Thank you for the amazing content as always! 🎉

  • @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.

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

    We need some merch with the slogans from the intro!

  • @balubalaji9956
    @balubalaji9956 Рік тому +2

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

  • @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...

  • @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.

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

    I feel mischievous watching such content 😂😂😂

  • @somashekarbr3597
    @somashekarbr3597 Рік тому +2

    your amazing
    right on point

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

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

  • @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.

  • @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.

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

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

  • @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.

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

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

  • @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

  • @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.

  • @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.

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

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

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

    My dude! Cool!

  • @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?

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

    They should wrap JS in Million. :O

  • @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!

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

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

  • @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

  • @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

  • @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"

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

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

  • @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!

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

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

  • @user-lv3cj7ky1x
    @user-lv3cj7ky1x Рік тому +1

    Font family name used in the vscode please?

    • @jherr
      @jherr  Рік тому +3

      JETBrains Mono

  • @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.

  • @viktor-dy9tr
    @viktor-dy9tr Рік тому

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

    • @backupmemories897
      @backupmemories897 7 місяців тому +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.

  • @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.

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

    why you are not using canvas?

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

      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 :)

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

    How can I install oha in windows 10

  • @Dylan_thebrand_slayer_Mulveiny

    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.

  • @user-wv7je3kn3d
    @user-wv7je3kn3d Рік тому

    Why do you look like Donald Trump?

  • @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. :)