-
Notifications
You must be signed in to change notification settings - Fork 47.4k
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
ReactDOM - The cost of extra 900 bytes #6128
Comments
It’s only 900 bytes because it aims to keep the post-split compatibility in 0.14 for a version. Since before 0.14, However, in the next versions we don’t have to support the old |
@gaearon True, but even if we move the code around, you are still eating a second round trip for no apparent reason. In the common case, a user will want |
Thanks for the explanation. It does however seems a little harsh that 4 requests. I could divide this into 2 scenarios:
|
Yeah, definitely seeing your points. On the other hand it feels like having different packaging for CommonJS and UMD might get really confusing: #5413 (comment). |
Yeah, but we could maintain that same API by having |
ReactDOM and React are good separation of concerns. However, except for special cases, React applications almost always require the ReactDOM as well. The special cases can obviously have their own builds which can remove the unnecessary dependency. But React officially should serve a single library which includes the ReactDOM as a single resource. It absolutely makes no sense for an extra network request for a library that's 900 bytes gzipped.
This cost is even multiplied, since the official CDNs seem to already have a redirection in place. At the moment of filing this issue, a request to https://fb.me/react-0.14.7.min.js ends up with 301 to https://fbcdn-dragon-a.akamaihd.net/hphotos-ak-xfa1/t39.3284-6/12624086_185960608428874_474870377_n.js
And similar redirects for ReactDOM. That's
4
requests in place of what could be a2
. 2 requests, for a mere 900 bytes. In other words, taking the overhead of TCP/IP and HTTP,an overhead of nearly half a kilobyte with about 600ms of latency (in my geographic location) for a mere 900 bytes
. Now, add to the fact that thegzip would probably nullify that 900 bytes almost entirely
if its included as a part of the other 70kb file, due to binary compression.I'm honestly quite surprised why it was even decided to separate them (Not as libraries, but in terms of deployment).
The text was updated successfully, but these errors were encountered: