SlideShare a Scribd company logo
Hi, my name is Chad Austin, and I’m here to tell you about
what led IMVU to select Emscripten as a key part of our
strategy to have a single C++ engine across all platforms,
including web browsers.




                                                             1
LLVM is an open source compiler infrastructure, mostly
commonly used as the foundation of the clang C/C++
compiler.
Emscripten translates LLVM into JavaScript suitable for web
browsers.




                                                              2
3
4
5
6
IMVU is a place where members use 3D avatars to meet new
people, chat, and play games.




                                                           7
8
Today IMVU is a downloadable application for Windows and
Mac.




                                                           9
10
11
Making best use of the hardware is key on mobile devices.




                                                            12
13
14
15
16
My testing methodology: run the benchmark in all compilers
with all optimization settings and pick the fastest.




                                                             17
At this point, I’m willing to pay a reduction in performance in
order to have a single C++ engine codebase.




                                                                  18
19
Same benchmark as before for comparison purposes.




                                                    20
asm.js is a big win. (But lack of SIMD makes it still slower
than native.)




                                                               21
So let’s look at a benchmark that doesn’t rely so much on
SIMD.




                                                            22
23
24
25
26
27
28
29
30
Note the excessive redundancy of the generated code. After Emscripten runs,
a series of JavaScript optimizers transform the generated code until it looks
like this:




                                                                                31
32
33
34
35
36
37
Note that LLVM has no high-level control flow, just branch
instructions.




                                                             38
Naive translation to JS results in an infinite loop containing a
switch. In effect, implementing goto.




                                                                   39
40
41
42
43
44
45
46
Another reason we prefer SCons over emcc is in the case where a change to
some C++ doesn’t necessarily modify the generated code. In that case, emcc
would attempt to relink, the slowest part, whereas SCons would know that
the linker inputs haven’t changed and finish the build early.




                                                                             47
48
Engine.min.js is the most important build, but it’s painful to
build and work with.
Engine.debug.js is ideal for debugging, but still takes time to
build.
Engine.iteration.js is for running unit tests.




                                                                  49
50
51
52
53
Pointer_stringify is a helper that takes the char* address and
creates a JS string from the heap.




                                                                 54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

More Related Content

What's hot (20)

PPT
LLVM
guest3e5046
 
PDF
Jvm internal
Go Tanaka
 
ODP
Java 9/10/11 - What's new and why you should upgrade
Simone Bordet
 
PDF
Svelte as a Reactive Web Framework
University of Moratuwa, Katubedda, Sri Lanka
 
PDF
Java8から17へ
onozaty
 
PDF
View customize plugin for Redmineの紹介 (2019年版)
onozaty
 
PDF
Linux Namespaces
Masami Ichikawa
 
PDF
COPY FROMで異常データをスキップできるようになった話(第45回 PostgreSQLアンカンファレンス@オンライン 発表資料)
NTT DATA Technology & Innovation
 
PDF
Three Optimization Tips for C++
Andrei Alexandrescu
 
PPTX
LLVM Instruction Selection
Shiva Chen
 
PPTX
Inversion of Control and Dependency Injection
Dinesh Sharma
 
PPTX
JobSchedulerでのジョブの多重実行・排他制御
OSSラボ株式会社
 
PDF
Interact2015:Host Guardian Service ってなに?(仮)
wind06106
 
PDF
マルチコアのプログラミング技法 -- OpenCLとWebCL
maruyama097
 
PDF
今秋リリース予定のPostgreSQL11を徹底解説
Masahiko Sawada
 
PPTX
Windows Internals for Linux Kernel Developers
Kernel TLV
 
PDF
P2P Container Image Distribution on IPFS With containerd and nerdctl
Kohei Tokunaga
 
PDF
DBパフォーマンスチューニングの基礎:インデックス入門
Akira Shimosako
 
PPTX
深センで半年間住んでMakeと研究をしてみた
Junichi Akita
 
PPTX
GitHub ActionsでiOSのCIを実現しよう
Shinya Nakajima
 
Jvm internal
Go Tanaka
 
Java 9/10/11 - What's new and why you should upgrade
Simone Bordet
 
Svelte as a Reactive Web Framework
University of Moratuwa, Katubedda, Sri Lanka
 
Java8から17へ
onozaty
 
View customize plugin for Redmineの紹介 (2019年版)
onozaty
 
Linux Namespaces
Masami Ichikawa
 
COPY FROMで異常データをスキップできるようになった話(第45回 PostgreSQLアンカンファレンス@オンライン 発表資料)
NTT DATA Technology & Innovation
 
Three Optimization Tips for C++
Andrei Alexandrescu
 
LLVM Instruction Selection
Shiva Chen
 
Inversion of Control and Dependency Injection
Dinesh Sharma
 
JobSchedulerでのジョブの多重実行・排他制御
OSSラボ株式会社
 
Interact2015:Host Guardian Service ってなに?(仮)
wind06106
 
マルチコアのプログラミング技法 -- OpenCLとWebCL
maruyama097
 
今秋リリース予定のPostgreSQL11を徹底解説
Masahiko Sawada
 
Windows Internals for Linux Kernel Developers
Kernel TLV
 
P2P Container Image Distribution on IPFS With containerd and nerdctl
Kohei Tokunaga
 
DBパフォーマンスチューニングの基礎:インデックス入門
Akira Shimosako
 
深センで半年間住んでMakeと研究をしてみた
Junichi Akita
 
GitHub ActionsでiOSのCIを実現しよう
Shinya Nakajima
 

Viewers also liked (17)

PDF
From a native app to a webapp using Node.js and emscripten
Florian Rival
 
PDF
HTML5 - New UI Library for Games, Chad Austin, IMVU
Chad Austin
 
PDF
IMVU: “But Does It Scale?” from Startup Lessons Learned Conference
Brett Durrett
 
PPTX
Allocate Stanford 2016
Stanford University
 
PPTX
Share and Tell Stanford 2016
Stanford University
 
PPTX
Nova Stanford 2016
Stanford University
 
PPTX
SalesStash Berkeley 2016
Stanford University
 
PPTX
Trace Lessons Learned H4Dip Stanford 2016
Stanford University
 
PPTX
Aggregate db Lessons Learned H4Dip Stanford 2016
Stanford University
 
PPTX
Peacekeeping Lessons Learned H4Dip Stanford 2016
Stanford University
 
PPTX
Space Evaders Lessons Learned H4Dip Stanford 2016
Stanford University
 
PPTX
Exodus Lessons Learned H4Dip Stanford 2016
Stanford University
 
PPTX
Hacking CT Lessons Learned H4Dip Stanford 2016
Stanford University
 
PPTX
Exit strategy Berkeley 2016
Stanford University
 
PPTX
HomeSlice Berkeley 2016
Stanford University
 
PPTX
Delphi Berkeley 2016
Stanford University
 
PPTX
Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016
Stanford University
 
From a native app to a webapp using Node.js and emscripten
Florian Rival
 
HTML5 - New UI Library for Games, Chad Austin, IMVU
Chad Austin
 
IMVU: “But Does It Scale?” from Startup Lessons Learned Conference
Brett Durrett
 
Allocate Stanford 2016
Stanford University
 
Share and Tell Stanford 2016
Stanford University
 
Nova Stanford 2016
Stanford University
 
SalesStash Berkeley 2016
Stanford University
 
Trace Lessons Learned H4Dip Stanford 2016
Stanford University
 
Aggregate db Lessons Learned H4Dip Stanford 2016
Stanford University
 
Peacekeeping Lessons Learned H4Dip Stanford 2016
Stanford University
 
Space Evaders Lessons Learned H4Dip Stanford 2016
Stanford University
 
Exodus Lessons Learned H4Dip Stanford 2016
Stanford University
 
Hacking CT Lessons Learned H4Dip Stanford 2016
Stanford University
 
Exit strategy Berkeley 2016
Stanford University
 
HomeSlice Berkeley 2016
Stanford University
 
Delphi Berkeley 2016
Stanford University
 
Fatal journeys (Team 621) Lessons Learned H4Dip Stanford 2016
Stanford University
 
Ad

Similar to Multiplatform C++ on the Web with Emscripten (20)

PPTX
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
David Voyles
 
PPTX
C++ for the Web
Patrick Charrier
 
PDF
Os Lattner
oscon2007
 
PDF
Developing and-benchmarking-native-linux-applications-on-android
Elvis Jon Freddy Sitinjak
 
PPTX
Cross platform development with C#
Michele Scandura
 
PPTX
Asm.js introduction
Oleksii Prohonnyi
 
PPTX
Developing a mobile cross-platform library
Kostis Dadamis
 
DOCX
Qtframework
Aditi Shrivastava
 
PDF
Minko - Build WebGL applications with C++ and asm.js
Minko3D
 
PPTX
Connecting C++ and JavaScript on the Web with Embind
Chad Austin
 
PPTX
Mobile Application Development- Configuration and Android Installation
Dr. Chandrakant Divate
 
PDF
How Java 19 Influences the Future of Your High-Scale Applications .pdf
Ana-Maria Mihalceanu
 
PDF
Oscon presentation
zigurd
 
PDF
Android is client Java
OSCON Byrum
 
PPTX
Advance Android Application Development
Ramesh Prasad
 
PDF
Java keynote preso
Artur Alves
 
PDF
Android : How Do I Code Thee?
Viswanath J
 
PDF
Ijaprr vol1-2-13-60-64tejinder
ijaprr_editor
 
ODP
An Introduction to WebAssembly
Daniel Budden
 
PPTX
Rasperry pi Part 9
Techvilla
 
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
David Voyles
 
C++ for the Web
Patrick Charrier
 
Os Lattner
oscon2007
 
Developing and-benchmarking-native-linux-applications-on-android
Elvis Jon Freddy Sitinjak
 
Cross platform development with C#
Michele Scandura
 
Asm.js introduction
Oleksii Prohonnyi
 
Developing a mobile cross-platform library
Kostis Dadamis
 
Qtframework
Aditi Shrivastava
 
Minko - Build WebGL applications with C++ and asm.js
Minko3D
 
Connecting C++ and JavaScript on the Web with Embind
Chad Austin
 
Mobile Application Development- Configuration and Android Installation
Dr. Chandrakant Divate
 
How Java 19 Influences the Future of Your High-Scale Applications .pdf
Ana-Maria Mihalceanu
 
Oscon presentation
zigurd
 
Android is client Java
OSCON Byrum
 
Advance Android Application Development
Ramesh Prasad
 
Java keynote preso
Artur Alves
 
Android : How Do I Code Thee?
Viswanath J
 
Ijaprr vol1-2-13-60-64tejinder
ijaprr_editor
 
An Introduction to WebAssembly
Daniel Budden
 
Rasperry pi Part 9
Techvilla
 
Ad

Multiplatform C++ on the Web with Emscripten

  • 1. Hi, my name is Chad Austin, and I’m here to tell you about what led IMVU to select Emscripten as a key part of our strategy to have a single C++ engine across all platforms, including web browsers. 1
  • 2. LLVM is an open source compiler infrastructure, mostly commonly used as the foundation of the clang C/C++ compiler. Emscripten translates LLVM into JavaScript suitable for web browsers. 2
  • 3. 3
  • 4. 4
  • 5. 5
  • 6. 6
  • 7. IMVU is a place where members use 3D avatars to meet new people, chat, and play games. 7
  • 8. 8
  • 9. Today IMVU is a downloadable application for Windows and Mac. 9
  • 10. 10
  • 11. 11
  • 12. Making best use of the hardware is key on mobile devices. 12
  • 13. 13
  • 14. 14
  • 15. 15
  • 16. 16
  • 17. My testing methodology: run the benchmark in all compilers with all optimization settings and pick the fastest. 17
  • 18. At this point, I’m willing to pay a reduction in performance in order to have a single C++ engine codebase. 18
  • 19. 19
  • 20. Same benchmark as before for comparison purposes. 20
  • 21. asm.js is a big win. (But lack of SIMD makes it still slower than native.) 21
  • 22. So let’s look at a benchmark that doesn’t rely so much on SIMD. 22
  • 23. 23
  • 24. 24
  • 25. 25
  • 26. 26
  • 27. 27
  • 28. 28
  • 29. 29
  • 30. 30
  • 31. Note the excessive redundancy of the generated code. After Emscripten runs, a series of JavaScript optimizers transform the generated code until it looks like this: 31
  • 32. 32
  • 33. 33
  • 34. 34
  • 35. 35
  • 36. 36
  • 37. 37
  • 38. Note that LLVM has no high-level control flow, just branch instructions. 38
  • 39. Naive translation to JS results in an infinite loop containing a switch. In effect, implementing goto. 39
  • 40. 40
  • 41. 41
  • 42. 42
  • 43. 43
  • 44. 44
  • 45. 45
  • 46. 46
  • 47. Another reason we prefer SCons over emcc is in the case where a change to some C++ doesn’t necessarily modify the generated code. In that case, emcc would attempt to relink, the slowest part, whereas SCons would know that the linker inputs haven’t changed and finish the build early. 47
  • 48. 48
  • 49. Engine.min.js is the most important build, but it’s painful to build and work with. Engine.debug.js is ideal for debugging, but still takes time to build. Engine.iteration.js is for running unit tests. 49
  • 50. 50
  • 51. 51
  • 52. 52
  • 53. 53
  • 54. Pointer_stringify is a helper that takes the char* address and creates a JS string from the heap. 54
  • 55. 55
  • 56. 56
  • 57. 57
  • 58. 58
  • 59. 59
  • 60. 60
  • 61. 61
  • 62. 62
  • 63. 63
  • 64. 64
  • 65. 65
  • 66. 66
  • 67. 67
  • 68. 68
  • 69. 69
  • 70. 70
  • 71. 71
  • 72. 72
  • 73. 73
  • 74. 74