Presentation: AutoCAD & WebAssembly: Moving a 30 Year Code Base to the Web
This presentation is now available to view on InfoQ.com
Watch videoWhat You’ll Learn
-
Learn how AutoDesk took a thirty year old code base and was able to port it to the web using WebAssembly.
-
Understand how they solved changes around build time, shared memory access, and Synchronous/Asynchronous code.
-
Hear tips and tricks building with WebAssembly today.
Abstract
AutoCAD is a computer-aided design desktop software application that was first released in 1982. With the advent of the internet age, there comes a need to extend AutoCAD's capabilities to the browser. However, the massive, complex, and constantly changing code base makes it impractical to rewrite everything in JavaScript. Therefore, the question remains: Can we really find an elegant way to leverage AutoCAD on the Web?
Enter WebAssembly! A compilation target for languages such as C/C++ that runs on modern browsers. For the first time in history, legacy code bases can now run on the Web at near native speed with the help of the Emscripten compiler. Nevertheless, there are mismatches between the programming paradigms of the desktop and Web world which greatly complicate the porting effort. Some of these include the use of synchronous blocking calls and shared memory on the desktop.
The goals of this session are two-fold. Firstly, the solutions for overcoming the above challenges will be explored in the context of existing Web APIs. Secondly, both the build time and performance implications of porting such a large code base will be addressed as well. As such, this talk will be helpful for developers who aspire to reuse their legacy software on the Web.
Your talk is about porting AutoCAD on the desktop to a browser with WebAssembly. How do you plan to go about the talk?
I plan to start my talk with how we arrived at our current technology stack (which is Emscripten and WebAssembly Binaryen) by talking about our journey from trying flash, JavaScript, asm.js, and, finally, getting to WebAssembly. After that, I would like to highlight some of the peculiarities of the large and constantly changing AutoCAD codebase that we had to deal with as well.
From there, I’ll talk about some of the challenges we faced with WebAssembly. Things like the larger code size, dealing with build time, and different programming paradigms on the desktop. I will talk about how we used ServiceWorkers and show some architecture diagrams for this, and I will demonstrate underlying memory accessors and dynamic linking example. Finally I will talk about how browser vendors are helping us improve performance.
Can you give me some example of some of the challenges with the different paradigms when dealing with the web vs desktop?
For example, you have synchronous vs asynchronous programming issues on the web. How you handle a blocking call on your desktop code base is very different than on the web. Another is shared memory between threads. Synchronous writes is supported on the desktop because you have shared memory that allows you to share data but you don’t have that on the web. There are also things like performance hits due to underlying memory accessors and lack of support for exceptions.
Are you going to talk about the interaction between javascript and WebAssembly or will you focus mostly on the performance, build time and asynchronous calls?
Emscripten handles most of the interaction between javascript and WebAssembly, so I will not focus on this aspect.
AutoCAD web application runs on a dual thread architecture. My focus will be on the build time and some of the tips and tricks to make it build fast. I will also focus on how we are passing messages from one thread to another.
I will also talk about some of the things that can help in reducing the binary size.
What do you hope a developer will take away from this talk?
I want them to go away with the conviction that it is possible to reuse their legacy apps on the web rather than rewrite code from scratch. I want to give them the practical knowledge on how to go about doing this, including the challenges they will face to make it work. Finally, I hope to pass on some tips and tricks to make things easier.
Similar Talks
Scaling DB Access for Billions of Queries Per Day @PayPal
Software Engineer @PayPal
Petrica Voicu
Psychologically Safe Process Evolution in a Flat Structure
Director of Software Development @Hunter_Ind
Christopher Lucian
Let's talk locks!
Software Engineer @Samsara
Kavya Joshi
PID Loops and the Art of Keeping Systems Stable
Senior Principal Engineer @awscloud
Colm MacCárthaigh
Are We Really Cloud-Native?
Director of Technology @Luminis_eu
Bert Ertman
The Trouble With Learning in Complex Systems
Senior Cloud Advocate @Microsoft
Jason Hand
How Did Things Go Right? Learning More From Incidents
Site Reliability Engineering @Netflix
Ryan Kitchens
What Breaks Our Systems: A Taxonomy of Black Swans
Site Reliability Engineer @Slack, Contributor to Seeking SRE, & SRECon Steering Committee
Laura Nolan
Cultivating High-Performing Teams in Hypergrowth
Chief Scientist @n26