You are viewing content from a past/completed QCon

Presentation: AutoCAD & WebAssembly: Moving a 30 Year Code Base to the Web

Track: Modern CS in the Real World

Location: Soho Complex, 7th fl.

Duration: 2:55pm - 3:45pm

Day of week: Thursday

Level: Advanced

Persona: Architect, Developer

Share this on:

This presentation is now available to view on InfoQ.com

Watch video

What 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.

Question: 

Your talk is about porting AutoCAD on the desktop to a browser with WebAssembly. How do you plan to go about the talk?

Answer: 

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.

Question: 

Can you give me some example of some of the challenges with the different paradigms when dealing with the web vs desktop?

Answer: 

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.

Question: 

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?

Answer: 

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.

Question: 

What do you hope a developer will take away from this talk?

Answer: 

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.

Speaker: Kevin Cheung

Software Architect @autodesk

Kevin is a software developer with the AutoCAD team and his main interest is in C++ and Web development. For the last few years, he has been focusing on using Emscripten to port C++ projects to asm.js and now WebAssemblyKevin enjoys spending time with his family and studying the Bible. 

Find Kevin Cheung at

Proposed Tracks

  • Trouble-Shooting in Production

  • Disrupting Technology on Wall Street

  • Resilience vs Failure in Architecture

  • The Weeds of Distributed File Systems

  • Organizational Agility

  • Product & Customer Focused Teams

  • Just Culture (Blameless Culture)

  • Modern CS in the Real World

  • Architectures You’ve Always Wondered About

  • Machine Learning and AI in the New Decade

  • Evolving Java - Including K8s/Containers, Kotlin and Impact on AOT

  • Ethical Considerations in Software

  • Microservices and Scalability

  • Container Slinging

  • Native Compilation Is Back (A Look at Non-Vm Compilation Targets)