How Vue.js as a web framework optimises rendering speed

Поделиться
HTML-код
  • Опубликовано: 8 сен 2024
  • Original talk "Seeking the Balance in Framework Design" by Evan You creator of Vue.js at JSConf.Asia 2019 in Singapore. Find it at • Evan You on Vue.js: Se...

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

  • @ninhdang1106
    @ninhdang1106 Год назад +295

    Just one short to distinguish between React and Vue :o

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

      ​@@darthvader4899 can you elaborate more on svelte in contrast to react or vue or both?

    • @darthvader4899
      @darthvader4899 Год назад +26

      @@starscream320 svelte is already a compiler which compiles your .svelte files into vanilla javascript

    • @ccgarciab
      @ccgarciab Год назад +22

      ​@@starscream320 Svelte takes this idea and runs with it. Svelte does no diffing and instead overloads the semantics of the assignment operator to detect reassignments and re-render only affected elements. This also allows it to ship much less js, making sites lighter and faster to process.

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

      react do same using keys

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

      Or react and sycamore

  • @xushenxin
    @xushenxin Год назад +42

    So next version of Vue will do direct dom update like Svelte?

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

      There is a proposal for vapour mode

    • @user-re8lt2gy3g
      @user-re8lt2gy3g Год назад

      they say that they will take the solidjs approch of doing things

  • @Steve-Richter
    @Steve-Richter Год назад +37

    Very difficult to debug a vite/vue /typescript program in the browser. Source maps are not accurate.

    • @ThatGeekAndrew
      @ThatGeekAndrew Месяц назад +1

      Somebody stopped generating his sourcemaps

    • @berthold64
      @berthold64 23 дня назад

      Just use vue cdn, no need compile and sourcemaps bullshit. If you cant use js framework via cdn, it's trash.

  • @icarusgk
    @icarusgk Год назад +32

    Vue already performs better than React in all cases and Svelte in some cases, just with VDOM optimizations.
    But later this year (2023) Vue will soon have a compiler too, just as Svelte’s called Vapor Mode.
    Dropping the VDOM completely and having a performance similar to that of SolidJS

    • @phoenix-tt
      @phoenix-tt Год назад +1

      Vue has a compiler :)

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

      @@phoenix-tt yup, I meant a compiler as in vDOM less compiler hehe

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

    Haven’t seen the whole video, but this is a very contrived example. In the real world, the component tree would be filled with hundreds of dynamic elements.

  • @masoud1128
    @masoud1128 Год назад +54

    Svelte, solidjs Qwik : 🤓

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

      Latest benchmarks show Vue3 as faster by a margin than svelte in total.

    • @acopier
      @acopier 6 месяцев назад

      all of these have basically no ecosystem

  • @anj000
    @anj000 Год назад +14

    Is it just me, or the code at the beginning and at the end is exactly fooking same?

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

      It is the exact same. He’s using the same markup as an example to distinguish how the vdom diffing algo needs to go through each tag compared to vue templates

    • @anj000
      @anj000 Год назад +5

      @@shivanshsharma7422 maybe I'm just stupid or this explanation is misleading.

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

      @@anj000 i think itd be better to watch the whole talk where it has his explanation on how vue tracks updates or whatever. Anyways, svelte ftw!

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

    would the static way to do this result in an instruction that uses a simple xpath?

  • @klemenko345
    @klemenko345 Год назад +13

    or you add an unique key to each p tag.

    • @jackwang9424
      @jackwang9424 11 месяцев назад

      unique key can just speed up the process of diff at the same level, Block tree can hoist all VDoms :)

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

    Evan es mi pastor

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

    I prefer raw WASM just to flex

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

    Isn't this how other programming language like Python (Jinja, Mako, DTL), PHP, Ruby on Rails, Go, Rust have been?

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

    what is original video of this shorts?

  • @khoroshoigra8388
    @khoroshoigra8388 Год назад +9

    in short, vue using virtual DOM

  • @Titanman316
    @Titanman316 Год назад +35

    *coughs in svelte*

    • @icarusgk
      @icarusgk Год назад +8

      *coughs in Vapor mode*

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

      Vapor mode wil change everything in terms of speed etc

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

      Coughs in knockout

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

      Good luck in finding svelte job

    • @semyaza555
      @semyaza555 10 месяцев назад

      @@yourivanmill Will it change the speed in which Nuxt3 released?

  • @darthvader4899
    @darthvader4899 Год назад +19

    Svelte is pioneer of this

    • @veronibishi206
      @veronibishi206 Год назад +12

      Pioneer of something vue has been doing since 2015?

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

      Svelte released November 2016, Vue released February 2014. Unless Svelte also pioneered time travel your comment is a lie.

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

      Knockout did it first my friend lol, just not with a compiler.

  • @StephanHoyer
    @StephanHoyer Год назад +21

    Or you can just build a simpler framework that uses just javascript as templating language and let the browser do the optimization for you 🤷‍♀️

    • @phoenix-tt
      @phoenix-tt Год назад +4

      No, you can't, as this will be yet another library. Vue does a lot more, starting from SSR and all the way to very cool features that make you productive.
      Don't focus on runtime

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

      Vue/nuxt just does everything slightly worse and uglier than react/next

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

      @@und0 and they do it bad already

  • @thelazycoder64
    @thelazycoder64 Год назад +5

    Can i get a full video

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

      Sure here you have 📼

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

      ​@@angelsv he wants to study. Give him a link

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

      @@nonicknameee Nah mate, user username checks out.

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

      @@nonicknameee he's lazy , why u care 🤣

  • @mahmoudelwan4337
    @mahmoudelwan4337 9 месяцев назад +1

    Original Video:
    ruclips.net/video/ANtSWq-zI0s/видео.html&ab_channel=JSConf

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

    Why does he say recursively? Isn’t it iteratively that you progress through the DOM?

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

      The algorithm to traverse a tree with nodes can be recursive.

  • @ohcrap2222
    @ohcrap2222 Год назад +11

    Why not just add an id? Maybe I'm not getting what he is saying.

  • @Gol_D_Roger_The_Pirate_King
    @Gol_D_Roger_The_Pirate_King Год назад +5

    So basically what is Svelte is doing from the start

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

      Svelte appeared after Vue so I don't get your point here. It sounds as if you want to say that Svelte invented that before Vue did which is not true

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

      @@DarkzarichV2 Svelte is doing that beofre Vue implements it. VueJs version 1 and 2 doesnt have that. What are you saying that VueJS invented that.

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

      @@Gol_D_Roger_The_Pirate_Kingand solid implemented it before svelte, and knockout before solid…

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

    Pair that with Inertia and Laravel and you gonna be a happy developer.

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

    What about AOT, cd already knows where is the exact location to change it right?

  • @guseynismayylov1945
    @guseynismayylov1945 4 месяца назад

    Or you can just use EHTML and map your data on template

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

    Someone simplify this for me please

  • @henrybenedict6357
    @henrybenedict6357 Год назад +19

    Svelte: 👀

    • @BackUp-cz6zn
      @BackUp-cz6zn Год назад +1

      let's go

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

      solidjs

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

      @@arson5304 this

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

      Vue already performs better than Svelte in some cases just with VDOM optimizations like this one

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

    Vue is the king ! Evan is the techlead!

  • @ar_xiv
    @ar_xiv 11 месяцев назад

    Why does it feel like we haven’t really done better than php

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

    Isn’t this basically also how MillionJS works?

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

    My computer has a conscious. Dun dun dunnnn

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

    Nuxt 3 is great

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

    🚀

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

    so many classes

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

    I think you meant iterative not recursion.

  • @VS-nq1ro
    @VS-nq1ro Год назад +6

    Angular ❤

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

    I'm feeling stupid but I don't see the difference between the two code fragments lol

    • @shrin210
      @shrin210 8 месяцев назад

      He is just explaining how the compiler driven development will give more performance than by implementing vdom.

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

    perf wise vue is most likely quicker but I hate the DX and prefer react personally

  • @joseluisguzman6881
    @joseluisguzman6881 2 месяца назад

    Nextjs

  • @user-lq7xz1th4x
    @user-lq7xz1th4x Месяц назад

    That's why Svelte doesn't use vdom lol

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

    P class NP complete process point.

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

    didn't make sense to me.

  • @1998goodboy
    @1998goodboy Год назад

    Yall ever heard about old school template? Like the ones we used to write in php? 🤔

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

      Templating doesn't inherently support reactivity, although you can always add the effect of reactivity with just js. The frameworks add the semantic layer that makes it easy and scalable.

    • @1998goodboy
      @1998goodboy Год назад

      @@ccgarciab its the reason why the internet is a sucky experience

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

    Still just talk and no walk

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

    Maybe dont use node

  • @mr.RAND5584
    @mr.RAND5584 24 дня назад

    Key

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

    Isn't it just creating a hash table of the "virtual dom" to have instant lookup and replace?

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

    it looks like boiler plate to me but i am not a web dev

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

    Template

  • @Tom_Seeker
    @Tom_Seeker 2 месяца назад

    It's obvious to me

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

    imagine obsessing over these nonproblems.

    • @chaost11
      @chaost11 Год назад +11

      What??? That's a big, big problem for large, complex websites

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

      This is the problem in the web. Our hardware is insane nowadays but somehow the web is always as slow and bloated...

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

      @@chaost11 the problem comes from making large, complex websites. Its unfortunate, but this kind of problem is a bandage for shit design, shit UX and/or feature creep gone too far. And the problem usually just does not start in the frontend, but from the data side altogether.
      In all my time working across the stack in a variety of companies, the ones that actually spend time designing and thinking end up making simple websites. Then your users will actually maybe use the thing.

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

      Sorry guys, but I’m new to programming and starting to grasp the idea of code structures and it’s expectations. Do you guys feel that following simple code rules are a good way to exercise algorithm implementation, or should I go into this understanding with a bit more of a challenging approach? I ask this because I sometimes am quick to refer to documentation rather than pushing my own ideals into a program and “seeing what happens” kind of behavior. I honestly find it good to take either route but with all the tools in the world, it’s easy to make an approach. But with the reality of time and limitations towards learning, I feel It’s risky to make wrong turns and take up too much time going in the wrong direction, so that’s something I feel I wanted clarification on.

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

    *Promo sm*

  • @victorangelo3373
    @victorangelo3373 10 месяцев назад

    frontend problems:

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

    Write an entire application to find out which is better. This is not a proper comparison.

    • @e-jarod4110
      @e-jarod4110 Год назад

      It would also not be a proper comparison though
      a proper comparison would be to write the same large app considering :
      - how much you understand the framework's internal stuff,
      - how much you optimises it,
      - within a limited timespan,
      - with one or many teams
      - with automated tests
      - the efficiency of each developer to release features
      - ...
      so you just keep some small comparisons like this because the "true" comparison would be impossible

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

    React: why don't you provide me keys and I will optimise this for you.. 😊

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

    The best solution would be to throw out JS and replace it with a programming language.

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

    Or don't write JavaScript and avoid all JavaScript problems :)

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

    Solution for people who use the same class name for every element, lmao.
    0/10

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

      but you're supposed to use a class name on multiple elements

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

      @@Apeuda From my experience, you should only use a class name when there are going to be multiple elements which rely on the same underying layout.
      Edit: Not for every single element throughout the entire application.

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

    Vue (budget react) monkey patching in features already invented by other libraries. If you want performance use solid or qwik. If you want full vdom capabilities use react. End of story

    • @Dino-Kupinic
      @Dino-Kupinic 4 дня назад

      brother whats your beef with vue lol

  • @a.andrade345
    @a.andrade345 Год назад

    Angular is better

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

    This genius is comparing a compiler to an AGI and talking about intentions

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

      WHAT??

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

      @@icarusgk what do you mean what? It's not hard to understand what I wrote.

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

      @@SahilP2648 In what point what AI mentioned in the vid? I don't get the AGI point

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

      @@icarusgk the guy in the video is talking about compiler understanding your coding intentions -_- how is it hard to understand that compilers just convert your code into bytecode (and check if the code even builds first). They don't understand your 'intentions'.

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

      @@SahilP2648 You're taking what Evan You said too literal

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

    Isn't this just the concept of a pure component?

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

    doesnt it all just use the browser dom api?

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

      His point is that if you have no constraints you need to constantly work with and traverse the entire DOM which quickly becomes slow and expensive, whereas a limited template makes the necessary DOM actions predictable and lets you avoid a lot of of unnecessary checks/traversals.

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

      @@CurseTheVulgar so its a sort of api between the virtual dom and real dom? and using the "api" thing is faster?

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

      @@rosux5540 Yes exactly. What it improves (i.e. where you gain speed) is essentially that it has "pre-calculated" a lot of DOM paths and element locations (but not just that) meaning it can better manipulate the DOM via the browser api without running costly functions like querySelectorAll()/getElementById()/etc. (There's a bit more to it, but basically that's the gist of it.)

  • @crftr-com
    @crftr-com Год назад +3

    💩ing on the virtual dom is only effective until the virtual dom makes a similar optimization.

    • @yaminnather521
      @yaminnather521 Год назад +5

      Unless it's not able to because of its constraints?
      What was the point of this comment after again?
      Pretty sure that guy explained it pretty clearly, I'm not that smart and even I understood it

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

      There's no code that runs faster than that which doesn't even exist. Virtual DOM can only play catch up to pre optimized, and therefore pre pruned code.