-
Notifications
You must be signed in to change notification settings - Fork 21
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
Use production mode for React that strips out all the warnings #3
Conversation
Shit that's a big difference. I'll re-run the tests on the same computer tomorrow. Cheers for this! |
Shiiiiiiiiiit. Such a simple change made that big of an effect. wow. |
Just want to chime in here - I was running the two versions locally and it seems the React version is doing way fewer actual updates than the Vue version, because the update delay is different: VueReactPerf/src/react.data.js Line 20 in 1d83fcd
Line 36 in 1d83fcd
(links above are from the commit before merging the PR that fixed this) Basically the Vue version is doing 10 times the work than the React version?... ouch |
Some really great insights. Thank you @vjeux and @yyx990803 for catching these two major bugs with the tests. We'll rerun and update our findings. |
I'm not sure whether this is relevant for the benchmark but the current "best practice" in React seems to be to also use these two babel transforms when running in production for additional performance optimization:
(see also https://github.com/thejameskyle/babel-react-optimize) EDIT: also allegedly pure functional components are faster than class components, I think? Not sure what relative impact this has. |
No, this is incorrect, they’re not. (And they’re slower than class components with |
Not yet? :) |
@pocketjoso use functional components sure, but decorate them with HOC that give you a shouldComponentUpdate shallow diff and get best of both worlds. import pure from 'recompose/pure';
const MyFunctionalComponent => props => <h1>props.message</h1>;
export default pure(MyFunctionalComponent); |
@gaearon Thanks for clarifying. I only remembered this quote from Ben Alpert:
Is that still on the roadmap? |
@export-mike I use |
@pocketjoso connect just provides a shouldComponentUpdate function to your container component so that'll be ok, to get better performance add this to all components so thats containers and presentational components. |
a bit of background @pocketjoso I discovered it from this message @gaearon added to the unmaintained PureComponent https://github.com/gaearon/react-pure-render |
Eventually, yea. I would say no earlier than facebook/react#6170 becomes a real thing. |
Thanks for all the great feedback - we've posted some updated results here: https://engineering.footballradar.com/a-fairer-vue-of-react-comparing-react-to-vue-for-dynamic-tabular-data-part-2/ |
Question: After all of the comparison is done, would you consider to switch to Vue from React, or at least implement the new projects with Vue? I am asking, because Vue does seem to be better for the particular case where a tabular data is changing frequently. This case suggests to use Rx with React, since we want to handle the data reactively. For other cases, where we do not have observable data, the performance difference would not apparently be so noticeable. Developers, as all humans, have preferences which means if one likes React's semantic more than Vue's, would it be reasonable for him to stick to React despite the fact that Vue outperforms React in particular cases. Also, React community is bigger so we have more React based libraries for common tasks and nice integration with webpack and redux for example (not sure if they are easily integrated with Vue as well). Would be nice to see how simulacra performs in the same context. Thank you for the great post btw! |
vue-cli gives you a great integration of vue with webpack or browserify. |
This benchmark is using the dev mode of React which enables a lot of developer warnings and is not meant to be used in production because it is way slower. This pull request enables production mode and the perf is totally different.
I bumped the number of games to 500 in both React and Vue and this is what the traces look like:
React:
Vue: