Topics

Featured in Development

Understandability is the concept that a system should be presented so that an engineer can easily comprehend it. The more understandable a system is, the easier it will be for engineers to change it in a predictable and safe manner. A system is understandable if it meets the following criteria: complete, concise, clear, and organized.

Featured in Architecture & Design

Sonali Sharma and Shriya Arora describe how Netflix solved a complex join of two high-volume event streams using Flink. They also talk about managing out of order events and processing late arriving data, exploring keyed state for maintaining large state, fault tolerance of a stateful application, strategies for failure recovery, data validation batch vs streaming, and more.

Featured in Culture & Methods

Tim Cochran presents research gathered from ThoughtWorks' varied clients and projects, and shows some of the metrics their teams have identified as guides to creating the platform and the culture for high performing teams.

Colin Eberhardt on What WebAssembly Is, and Plans for Version 2.0

Wesley Reisz talks to Colin Eberhardt, the Technology Director at Scott Logic, talks about what WebAssembly (WASM) is, a bit of the history of JavaScript, and plans for WebAssembly 2.0 including the threading model and GC.

Key Takeaways

WebAssembly brings another kind of virtual machine to the browser that is a much more low-level language.

One of the goals of WebAssembly is to make a new assembly language that is a compilation target for a wide range of other languages such as C++, Java, C# and Rust. C++ is highly mature, Rust is maturing rapidly. Java and C# are a little further behind because of the lack of garbage collection support in WebAssembly. At some point in the future WebAssemblywill have it’s own garbage collection perhaps by using the Javascript garbage collector.

At runtime you use JavaScript to invoke functions that are exported by your WebAssembly instance. It should be noted that at the moment there is quite a lot of complexity involved in interfacing between WebAssembly and JavaScript. A lot of this complexity comes from the type system.

WebAssembly only supports four types - 2 integer types and 2 floating point types. To model strings you share the same piece of linear memory - memory that can read from and write to from both WebAssembly and JavaScript.

WebAssembly is still a very young technology. Future plans include threading support, garbage collection support, multiple value returns.

2:56 If you’re writing code to run directly on a microprocessor, the instruction that the processor understands is a low-level machine code; bytes and so on.

3:06 Most assembly languages will have a slightly more readable version - the assembly language.

3:16 You’ll have opcodes being represented as mnemonics instead of bytes.

3:21 So the text format you see for web assembly is just a more human version of the binary format which is the underlying web assembly itself.

3:31 It’s a very light syntactic sugar - there’s almost a 1-1 mapping between the text format and the binary format.

How is web assembly different from writing, say, Flash?

3:35 Part of the reason why people think it sounds similar is because one of the motivations of creating web assembly is to create a new assembly language which is a compilation target for a range of high level languages.

3:50 So C#, Java, Rust, C++ and others are now able to be compiled into web assembly and run in the browser.

4:00 That immediately makes people think of how they used to be able to run those kind of languages in the browser.

4:05 There are some very fundamental differences in the way this is being achieved.

4:15 Flash, Silverlight and so on used the plugin model, which is a bolt-on to the side of the browser that lets you have a different execution environment and a restrictive API to communicate between that runtime and the first-class runtime in the browser.

4:30 Web assembly isn’t like that; it is very tightly integrated within the JavaScript virtual machine, and there’s a very close synergy between the two.

6:55 On the browser, we’ve got an advanced runtime with multiple levels of optimisation.

7:00 In the middle, we’ve got a horrible mechanism by where we’re delivering it in a basic and very inefficient text format, because that’s the way the web was designed.

7:15 The impact of the bottleneck is twofold; one is the time it takes to deliver that to the browser, and the other is the overall performance and the time it takes to warm up the JavaScript code to run quickly within the browser.

7:30 Ignoring the fact that web assembly brings different languages to the web, JavaScript itself is pretty inefficiently executed.

Doesn’t the advent of web assembly mean that we will see larger binaries being delivered to clients?

8:10 I can understand the concern, but within the web we’ve optimised for performance and size - but on the desktop there hasn’t been that much pressure.

8:25 If a desktop executable is 50Mb or 100Mb it generally doesn’t matter - but if you add an extra 20% payload to a website, people care about that.

8:40 Technically speaking, if you take a single algorithm - like one that renders a Mandlebrot set - if you compile that to minified JavaScript and separately compile it to web assembly, the web assembly will be smaller because it’s a binary format.

9:30 On the web, we have the notion of bloat - it doesn’t matter whether we’re talking about JavaScript or CSS.

9:35 You’ll find people putting JQuery in the page to use a single function, or all of Bootstrap when they’re only using one or two classes.

9:50 With all of these technologies, you’ll find there are ways to optimise them: with Bootstrap, you can customise your own build, for JavaScript you can use tree shaping, which means you only deliver the required code to the browser.

10:00 You can create bloat in any technology - but people care about this, and our tooling is quite advanced these days, so you can do some clever things.

How does wasm inject itself into a web page?

10:55 Our web assembly hello world is something that returns the sum of two numbers.

References

About QCon

QCon is a practitioner-driven conference designed for technical team leads, architects, and project managers who influence software innovation in their teams. QCon takes place 8 times per year in London, New York, Munich, San Francisco, Sao Paolo, Beijing, Guangzhou & Shanghai. QCon New York is at its 9th Edition and will take place Jun 15-19, 2020. 140+ expert practitioner speakers, 1000+ attendees and 18 tracks will cover topics driving the evolution of software development today. Visit qconnewyork.com to get more details.

More about our podcasts

You can keep up-to-date with the podcasts via our RSS Feed, and they are available via
SoundCloud,
Apple Podcasts,
Spotify,
Overcast
and the Google Podcast.
From this page you also have access to our recorded show notes. They all have clickable links that will take you directly to that part of the audio.