New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Todomvc vue Step 01 #114
Todomvc vue Step 01 #114
Conversation
resources/tests.mjs
Outdated
@@ -248,8 +248,8 @@ Suites.push({ | |||
}); | |||
|
|||
Suites.push({ | |||
name: "VueJS-TodoMVC", | |||
url: "todomvc/architecture-examples/vuejs-cli/dist/index.html", | |||
name: "TodoMVC-Vue-Webpack", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why rename to include "webpack" (in the suite name but also the file structure)? My understanding from https://docs.google.com/document/d/1MXxk9DryJmvAmPMt2uMneaS3J5Y-dMFGt4EGvMzhhJE/edit#heading=h.175iv9aumkej is that we aren't, for example, planning to include multiple variations based on build tooling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just personal naming preference - removing webpack from test name 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll also rename the directory shortly... uno momento!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems reasonable to me, thanks. cc @julienw in case there's additional comments but I'm fine to land this
Looks reasonable to me as well! |
All of the following comments can be handled follow-ups, and do not block this pull request. I discussed with a friend who knows vue better than I do (@enguerran 👋), he was surprised by a few things:
I also tested the code locally. It works pretty well, but I found the following difference compared to the other versions:
|
Thanks @julienw & @enguerran! |
@rniwa - how is this one looking? |
Deleting items sync got 3-6x slower in Safari, Firefox, & Edge but only 2x in Chrome. We need to understand that discrepancy. |
The app logic didn't change and when you click the "x" button. This leaves us with two areas:
Additional changes were tested with each step and didn't introduce the score differences that you see:
The scores are hard to compare in my opinion when the base scores are already really small. In this case it seems that "something under the hood" introduced the difference and it's hard to figure out exactly what that is. If it's the framework that somehow introduced the latency, should we not upgrade? If it's the infra (bundler, compression, optimization, transpiling) that comes with vue, is that something we should focus on and do look into differences (which essentially means we are comparing bundlers). |
The problem here is there is a massive discrepancy between browsers. I'm not comfortable accepting that without understanding why. |
I can try separating the webpack update from the vue update and maybe that'll let us pinpoint where it's coming from. |
Here's a comparison of a single iteration of the delete step: Current (4.2ms): https://share.firefox.dev/3yVCQlh I haven't investigated it closely but it appears that the bulk of the difference is that the click handler the current one (2.1ms) has a single function e that is called and in the new one (6.9ms) there's a deeper stack through $bound -> deleteTodo -> filter+set which call a number of functions beneath them. |
To be clear, there are many click events in the delete step which are aggregated in that stack chart - they can be seen in the marker chart in DOMEvent for old: https://share.firefox.dev/3FInjct and new: https://share.firefox.dev/3JZmgrd. In the old version a few of the individual clicks are slow (but overall are fast enough that we may be missing samples underneath) but in the new version many of them are. If this build setup is typical for Vue 3 I'm not too concerned about the discrepancy. @flashdesignory can you share what you have planned for the "small refactor is still following with step 02."? Maybe that will change how things are called a bit. |
@bgrins - thanks for looking into the differences! It's what I suspected, since the todo application didn't change from it's delete implementation.
|
<ul class="todo-list"> | ||
<li class="todo" v-for="todo in filteredTodos" :class="{completed : todo.completed, editing : todo === editing }"> | ||
<li class="todo" v-bind:key="todo.id" v-for="todo in filteredTodos" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation about :key
says that it should be just this, not v-bind:key
=> https://vuejs.org/api/built-in-special-attributes.html#key
BTW I see this wasn't here before. I doubt this would explain the performance difference but could it be worth looking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah - :key is the shorthand I believe... will adjust
(also already tested, there is no performance gain when I remove it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed!
I had another look on profiles using the development server for each versions, so that I could see better what could be happening. I noticed that in the new version we're calling See profiles (take them with a grain of salt because they're were taken while running the dev server): The list of things that Note: in case you want to try locally, please note that you'll need to use node v8 to run or build the old version. |
Note: another obvious change compared to the old version is the addition of |
"npm": ">=8.19.3" | ||
}, | ||
"scripts": { | ||
"serve": "vue-cli-service serve", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the other components (I looked at react / react-redux / preact), we used start
for the development server and serve
for serving the result of the build. backbone
uses dev
which is more explicit.
On the long run it would be good to be consistent, but since serve
hasn't been used yet, how about using either start
or dev
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I am getting confused too. Ember-cli creates the scripts, but I'll rename to "dev"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
I did try that before, with no differences. I'll give it another try though. update: tried again removing the router and no difference. |
I guess the question is if this change is intrinsic to Vue v2 vs. v3 or if it's something specific to the way it's written here. |
I believe it's intrinsic to 2 vs 3. For example from https://vuejs.org/guide/extras/reactivity-in-depth.html#how-reactivity-works-in-vue
|
The Proxy thing being just one example. I think they work differently and so there are just going to be different things to optimize. With deleting in particular we can see no logic changes in the PR but we can see it's acting differently (and more slowly) now with 3. |
@rniwa - just following up on this pr - are we good to merge this one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rniwa - just following up on this pr - are we good to merge this one?
Yeah, thanks for all your analysis, everyone.
This pr updates vue 2 -> vue 3. This step resulted in a lot of changed files, since I needed to install vue-cli 3.2.6 and then I manually updated vue to 3.2.47. With this "simple" upgrade, I needed to fix a few bugs that kept the app from building.
Additionally a lot of files from the previous build were consolidated by vue-cli.
The logic in the actual Todo app didn't change and a small refactor is still following with step 02.
Speedometer updates
vue-cli
tovue
Vue updates
Scores:
https://gist.github.com/flashdesignory/6c9c30fdf68597d949e9fe3f61b90f8b
Since nothing changed in regards to adding, toggling or removing the todos (which the test performs), I assume the slight difference has to do with the vue update.
@kara