{"id":88,"date":"2019-02-03T18:57:06","date_gmt":"2019-02-04T01:57:06","guid":{"rendered":"http:\/\/codingrestart.com\/?p=88"},"modified":"2019-02-05T17:02:35","modified_gmt":"2019-02-06T00:02:35","slug":"webassembly","status":"publish","type":"post","link":"https:\/\/codingrestart.com\/home\/webassembly\/","title":{"rendered":"WebAssembly"},"content":{"rendered":"\n<p>Until recently, JavaScript was the only language supported by all web browsers. But it was difficult to compile it efficiently and the JavaScript applications typically run much slower than native applications.<\/p>\n\n\n\n<p>Then, programmers from the four main browser vendors designed a new language, sort of a machine code for the web, and called it WebAssembly. The new language was first announced in the &#8220;<a href=\"https:\/\/github.com\/WebAssembly\/spec\/blob\/master\/papers\/pldi2017.pdf\">Bringing the Web up to Speed with WebAssembly<\/a>&#8221; paper in 2017, a specification published together by Google, Microsoft, Mozilla, and Apple. The specification lists in detail the formal syntax and explains design choices made. A major design goal of WebAssembly has been high performance without sacrificing safety or portability. To provide security, each WebAssembly module is designed to have a single block of memory (array of bytes), disjoint from code space and other internal memory spaces. It is not possible for compiled programs to corrupt their execution environment.<\/p>\n\n\n\n<p>This week, the &#8220;<a href=\"https:\/\/arxiv.org\/pdf\/1901.09056.pdf\">Analyzing the Performance of WebAssembly vs. Native Code<\/a>&#8221; study was published, which appeared to throw cold water on claims that WebAssembly is only about 10% slower than native code. The study shows numbers that are closer to 50-90% slower. However, in order to run large suite of performance tests <a href=\"https:\/\/www.spec.org\/cpu2017\/\">SPEC CPU<\/a>, the authors significantly modified how WebAssembly is run in the Unix environment by adding support for a file system and I\/O. It is not clear if their implementation is sound.<\/p>\n\n\n\n<p>While discussing WebAssembly, you might be wondering about what is the level of WebAssembly support across web browsers. For this purpose, head over to <a href=\"https:\/\/caniuse.com\/#search=webassembly\">CanIUse.com<\/a>, a web site that details web technology support on a per-browser basis. When searching for &#8220;WebAssembly&#8221;, you get the following picture, indicating that all major browsers do support WebAssembly.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"91\" data-permalink=\"https:\/\/codingrestart.com\/home\/webassembly\/wasm\/\" data-orig-file=\"https:\/\/i0.wp.com\/codingrestart.com\/wp-content\/uploads\/2019\/01\/WASM.png?fit=859%2C380&amp;ssl=1\" data-orig-size=\"859,380\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"WASM\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/codingrestart.com\/wp-content\/uploads\/2019\/01\/WASM.png?fit=840%2C372&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/codingrestart.com\/wp-content\/uploads\/2019\/01\/WASM.png?resize=569%2C251\" alt=\"\" class=\"wp-image-91\" width=\"569\" height=\"251\" srcset=\"https:\/\/i0.wp.com\/codingrestart.com\/wp-content\/uploads\/2019\/01\/WASM.png?w=859&amp;ssl=1 859w, https:\/\/i0.wp.com\/codingrestart.com\/wp-content\/uploads\/2019\/01\/WASM.png?resize=300%2C133&amp;ssl=1 300w, https:\/\/i0.wp.com\/codingrestart.com\/wp-content\/uploads\/2019\/01\/WASM.png?resize=768%2C340&amp;ssl=1 768w\" sizes=\"auto, (max-width: 569px) 85vw, 569px\" \/><figcaption>Screenshot from CanIUse.com searching for WebAssembly support. All major browsers support it, with the exception of an outdated Internet Explorer. Box sizes are relative to browser popularity. Numbers in boxes indicate browsers&#8217; versions.<\/figcaption><\/figure>\n\n\n\n<p>I work in CAD software development, so I read with great interest about Autodesk&#8217;s recently completed <a href=\"https:\/\/through-the-interface.typepad.com\/through_the_interface\/2018\/03\/the-future-of-autocad.html\">rewrite<\/a> of its behemoth AutoCAD software to support web browsers by using the LLVM framework with Emscripten on the back-end to produce WebAssembly. Considering millions lines of code comprise AutoCAD, it was no small feat.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"92\" data-permalink=\"https:\/\/codingrestart.com\/home\/webassembly\/autocad\/\" data-orig-file=\"https:\/\/i0.wp.com\/codingrestart.com\/wp-content\/uploads\/2019\/01\/AutoCAD.png?fit=1024%2C670&amp;ssl=1\" data-orig-size=\"1024,670\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"AutoCAD\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/codingrestart.com\/wp-content\/uploads\/2019\/01\/AutoCAD.png?fit=840%2C550&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/codingrestart.com\/wp-content\/uploads\/2019\/01\/AutoCAD.png?fit=840%2C550\" alt=\"\" class=\"wp-image-92\" width=\"601\" height=\"392\" srcset=\"https:\/\/i0.wp.com\/codingrestart.com\/wp-content\/uploads\/2019\/01\/AutoCAD.png?w=1024&amp;ssl=1 1024w, https:\/\/i0.wp.com\/codingrestart.com\/wp-content\/uploads\/2019\/01\/AutoCAD.png?resize=300%2C196&amp;ssl=1 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><figcaption>Autodesk&#8217;s AutoCAD Web browser based user interface.<\/figcaption><\/figure>\n\n\n\n<p>I suspect that I will come back to this topic in a future blog post here at CodingRestart. Until then, happy coding!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Until recently, JavaScript was the only language supported by all web browsers. But it was difficult to compile it efficiently and the JavaScript applications typically run much slower than native applications. Then, programmers from the four main browser vendors designed a new language, sort of a machine code for the web, and called it WebAssembly. &hellip; <a href=\"https:\/\/codingrestart.com\/home\/webassembly\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;WebAssembly&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[5],"tags":[],"class_list":["post-88","post","type-post","status-publish","format-standard","hentry","category-web"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paAAlH-1q","jetpack-related-posts":[{"id":233,"url":"https:\/\/codingrestart.com\/home\/dangers-of-nlp\/","url_meta":{"origin":88,"position":0},"title":"Dangers of NLP","author":"Viktor Sanek","date":"June 9, 2019","format":false,"excerpt":"Natural language processing (NLP) continues its rapid advance, leading some people to fear its latest results. The research organization OpenAI published a blog post titled \"Better Language Models and Their Implications\" summarizing its progress on \"predicting the next word, given all of the previous words within some text\". OpenAI calls\u2026","rel":"","context":"In &quot;Machine Learning&quot;","block_context":{"text":"Machine Learning","link":"https:\/\/codingrestart.com\/home\/category\/machine-learning\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/codingrestart.com\/wp-content\/uploads\/2019\/06\/GPT-2.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/codingrestart.com\/wp-content\/uploads\/2019\/06\/GPT-2.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/codingrestart.com\/wp-content\/uploads\/2019\/06\/GPT-2.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/codingrestart.com\/wp-content\/uploads\/2019\/06\/GPT-2.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":1,"url":"https:\/\/codingrestart.com\/home\/hello-programmers\/","url_meta":{"origin":88,"position":1},"title":"Hello programmers!","author":"Viktor Sanek","date":"May 7, 2017","format":false,"excerpt":"Welcome to CodingRestart.com, blog for seasoned developers that want to upgrade their skills. If any of the following is true for you, this site is for you: You feel threatened by younger colleagues, because you do not know popular programming languages and buzzwords they use. You think Kernighan and Ritchie's\u2026","rel":"","context":"Similar post","block_context":{"text":"Similar post","link":""},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65,"url":"https:\/\/codingrestart.com\/home\/okrs\/","url_meta":{"origin":88,"position":2},"title":"OKRs","author":"Viktor Sanek","date":"January 13, 2019","format":false,"excerpt":"Recently I read several articles on OKRs\u00a0(Objectives and Key Results), a method for setting and tracking the goals leading to better alignment of goals in an organization. OKRs were started by Andy Grove of Intel and first documented in his book \u201cHigh Output Management\u201d from 1983. The OKRs concept is\u2026","rel":"","context":"In &quot;Management&quot;","block_context":{"text":"Management","link":"https:\/\/codingrestart.com\/home\/category\/management\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":180,"url":"https:\/\/codingrestart.com\/home\/anki-best-practices\/","url_meta":{"origin":88,"position":3},"title":"Anki: Best Practices","author":"Viktor Sanek","date":"April 28, 2019","format":false,"excerpt":"This post concludes the series of posts on Anki and follows the post introducing Anki and another one about the theory behind Anki. I have been using Anki for five years and achieved high consistency in completing daily reviews. Here are my best practices: Be selective about cards you create\u2026","rel":"","context":"In &quot;Anki&quot;","block_context":{"text":"Anki","link":"https:\/\/codingrestart.com\/home\/category\/anki\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":30,"url":"https:\/\/codingrestart.com\/home\/why-is-smart-pointer-better\/","url_meta":{"origin":88,"position":4},"title":"Why is smart pointer better than a raw one?","author":"Viktor Sanek","date":"May 21, 2017","format":false,"excerpt":"In a previous post\u00a0I suggested that raw pointers should be replaced by smart pointers. This post explains why smart pointers are better than raw ones and how to convert an existing code using raw pointers to use smart pointers. For the sake of this post, when I refer to smart\u2026","rel":"","context":"In &quot;C\/C++&quot;","block_context":{"text":"C\/C++","link":"https:\/\/codingrestart.com\/home\/category\/uncategorized\/cc\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":171,"url":"https:\/\/codingrestart.com\/home\/theory-behind-anki\/","url_meta":{"origin":88,"position":5},"title":"Theory Behind Anki","author":"Viktor Sanek","date":"April 23, 2019","format":false,"excerpt":"This post covers the theory behind Anki and follows the previous post introducing Anki. The last post in this series describes best practices for using Anki. One of the best meta-analyses reviewing best approaches to learning is Improving Students\u2019 Learning With Effective Learning Techniques by Dunlosky et al. If I\u2026","rel":"","context":"In &quot;Anki&quot;","block_context":{"text":"Anki","link":"https:\/\/codingrestart.com\/home\/category\/anki\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/codingrestart.com\/home\/wp-json\/wp\/v2\/posts\/88","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codingrestart.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codingrestart.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codingrestart.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codingrestart.com\/home\/wp-json\/wp\/v2\/comments?post=88"}],"version-history":[{"count":9,"href":"https:\/\/codingrestart.com\/home\/wp-json\/wp\/v2\/posts\/88\/revisions"}],"predecessor-version":[{"id":109,"href":"https:\/\/codingrestart.com\/home\/wp-json\/wp\/v2\/posts\/88\/revisions\/109"}],"wp:attachment":[{"href":"https:\/\/codingrestart.com\/home\/wp-json\/wp\/v2\/media?parent=88"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codingrestart.com\/home\/wp-json\/wp\/v2\/categories?post=88"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codingrestart.com\/home\/wp-json\/wp\/v2\/tags?post=88"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}