10 karma · joined Aug 2, 2017 (9y ago) · 14 submissions
comment 7y ago · link · parent
But more to your point, I understand health care costs are crazy (especially in the US), but I am concerned that capping health care expenditures will dis-incentivize companies from taking risks on new vaccines and therapies.
comment 8y ago · link · parent
And of course, people want to build even richer experiences (live streaming, 360 media, etc) so there is a lot of appetite for loading more code in the same amount of time.
comment 9y ago · link · parent
I don't think the "burden of proof" philosophy requires me to disprove every other possible approach, right?
I explained my reasoning for my statements in the comment itself. If you believe WASM could address this use case better, and are so inclined to build a toy proof-of-concept JS-to-WASM compiler, I'd be very interested in seeing it.
comment 9y ago · link · parent
With respect to your example of unnecessary modules, sometimes the dependency trees between modules are non-obvious. But more to the point, the code served to a user is NOT personalized for each individual user and to their specific newsfeed and UI contents. This is actually a performance optimization. Facebook looks at which modules are most commonly required across most users based on their recent activity, and then bundles those common modules into large packages and pushes them aggressively to the browser. This actually results in a very large loading-time win, but ends up overserving some % of extra modules that are not needed by a specific user.
comment 9y ago · link · parent
Here's what I have in my FB homepage during a random load:
- Search bar for searching people/groups/posts/pages
- News ticker
- Friend requests, Notifications
- Sidebar ads
- A rich text editor for sharing my status
- A newsfeed story with a special "memory - 3years ago" feature
- Comments & commenting UI under newsfeed stories
- Suggestions for "People You May know"
- A video auto-playing a clip from a friend, with capability to auto-select between tracks of different video quality based on bandwidth (including bandwidth estimator code)
- And probably a dozen different A/B experiments that I'm a part of
It takes a lot of code just to render all these UI elements. If I interact with any of them, additional code is loaded (you can see this in the Network monitor).This homescreen UI is as rich as any desktop application and requires no less code to render. The problem being addressed in this proposal is that a native version of this app would start a lot faster than the web version. And that's because a browser will parse all the code files loaded on startup in an app (inefficiently, by necessity), but a native app will only read the code for the code paths that are actually executed.
Basically, O(code executed) is a lot better than O(all files containing code that is executed). And this proposal features a more parser-friendly encoding and change to the parsing semantics.
comment 9y ago · link · parent
It's much easier to support C++ in WebAssembly. C++ and other statically typed languages can be compiled ahead of time to low-level instructions that manipulate memory or registers in a virtual CPU.
It's much more difficult to compile dynamic languages. Consider a JavaScript statement like:
let result = a + b;
If this were a statically typed language, the compiler would know "a" and "b" are integers and can compile it into a single ADD.INT assembly instruction.
In a dynamically typed language, that "+" symbol could be an integer addition, or a floating-point addition, or a string concatenation depending on the types of "a" and "b". So what should the JS-to-WASM compiler generate? It has to generate different code to handle all the different data types, including throwing an exception for invalid types.
There would be a few problems with WASM code generated by such a compiler:
1) the generated code with all this extra checking is not going to be performant, 2) the generated code would be much larger, which would hurt transfer & parsing times, 3) the compiler would essentially be outputting the JavaScript interpreter in WASM by adding all these runtime guards for types.
> Beyond the MVP, another high-level goal is to improve support for languages other than C/C++. This includes allowing WebAssembly code to allocate and access garbage-collected (JavaScript, DOM, Web API) objects
Adding GC and DOM interop will help WASM adoption, but you'll still have the issues I described above if you try to compile JS codebases to WASM.
> statically typed languages for web development
Yes, people can use statically typed languages for web dev, and if they compile them to WASM after it has GC and fast DOM interop support, they will get performance wins vs transforming their codebases to plain JS.
But there are productivity advantages from using dynamically-typed languages during development and there are existing, very large web app codebases written in JavaScript which cannot be typed.
comment 9y ago · link · parent
comment 9y ago · link · parent
Some of the design is documented here https://www.facebook.com/notes/facebook-engineering/bigpipe-...
Facebook has done a TON of optimization. The fundamental issue is that Facebook is not a webpage, it's a full application. And the Web as an application platform lags behind native platforms with respect to startup performance.
I explained why Facebook.com is really an app in this comment https://news.ycombinator.com/item?id=14912393
Now compare the functionality of the Facebook Android app vs Facebook desktop webpage (nearly identical) and look at their respective installed sizes (~7MB vs ~180MB).
This proposal will benefit both web apps and web documents. And more importantly, it will allow people to build richer, more sophisticated applications on the web without sweating over extra kilobytes in their JS code size.
comment 9y ago · link · parent
- It contains a fully-fledged messenger application that supports payments, videoconferencing, sharing rich media etc
- The newsfeed supports interactive 360-degree video, a live video player, mini-games in the newsfeed, and lots of other rich/interactive media
- It's a gaming platform for 3rd party games
- It's a discussion forum, groups management system, event planning UI
- Photo sharing and editing platform, as well as live video streaming tool
- A platform for businesses to have an online presence (Pages)
- A peer-to-peer online marketplace (called "Marketplace")
And a dozen other things I can't think of right now. You might say "but I don't use all of those things". That's another tricky part, the fact that every user has a different "configuration" and different types of content in their newsfeed at any given moment, requiring them to be served different sets of JavaScript code.