Questions tagged [asm.js]

An strict subset of JavaScript that can be used as a low-level, efficient target language for compilers.

asm.js is a strict subset of JavaScript that can be used as a low-level, efficient target language for compilers. This sublanguage effectively describes a safe virtual machine for memory-unsafe languages like C or C++. A combination of static and dynamic validation allows JavaScript engines to employ an ahead-of-time (AOT) optimizing compilation strategy for valid asm.js code.

Resources

131 questions
103
votes
3 answers

What is the difference between asm.js and WebAssembly?

I have been reading about asm.js and WebAssembly recently: http://ejohn.org/blog/asmjs-javascript-compile-target/ https://brendaneich.com/2015/06/from-asm-js-to-webassembly/ I am still confused about a few things: Is asm.js code compiled in time…
NeoWang
  • 13,687
  • 19
  • 61
  • 112
61
votes
7 answers

Can regular JavaScript be converted to asm.js, or is it only to speed up statically-typed low-level languages?

I have read the question How to test and develop with asm.js?, and the accepted answer gives a link to http://kripken.github.com/mloc_emscripten_talk/#/. The conclusion of that slide show is that "Statically-typed languages and especially C/C++ can…
Oriol
  • 225,583
  • 46
  • 371
  • 457
39
votes
2 answers

Why does asm.js deteriorate performance?

Just to see how it performs, I wrote a very short asm.js module by hand, which simulates the 2D wave equation using 32-bit integer math and typed arrays (Int32Array). I have three versions of it, all as similar as possible: Ordinary (i.e. legible,…
jtiscione
  • 960
  • 6
  • 11
30
votes
1 answer

Firefox does not seem to be faster using the asm.js profile, yet Chrome is

I am trying to understand how exactly ASM works and when it kicks in. I took a small function from the asm.js website. I wrap it using the module pattern: once for asm, once with the same syntax but without the "use asm" annotation, and once like…
Thomas
  • 381
  • 3
  • 6
24
votes
4 answers

handwriting asm.js - how can you track javascript objects in the heap?

I am writing priority queues and octrees in the asm.js subset of Javascript in order to squeeze the last possible performance out of them. However, how do you store references to Javascript objects in the asm.js function's heap buffer? Right now, my…
Will
  • 68,898
  • 35
  • 156
  • 231
20
votes
3 answers

Compile Java to asm.js

asm.js is in coming. Now there is even rumors of Chrome soon supporting it fully. But so far it has been used to compile C/C++ source into JavaScript that would run with near native speed (depends on how you define near native ...) I have been…
Sebastien Diot
  • 6,961
  • 5
  • 41
  • 78
19
votes
1 answer

TypeScript performance (asm.js, closure compiler) and overhead

I'm looking into using TypeScript combined with a client-side MVC (most likely Backbone.js + Marionette.js or Ember.js) for future projects and therefor have a few questions related to performance and optimisation : How does TypeScript output…
m_vdbeek
  • 3,384
  • 5
  • 40
  • 76
16
votes
1 answer

How to test the availability of asm.js in a web browser?

Imagine I have a asmjs script but before running the script, I'd like to test and see if the browser supports asm.js or not. If it is false, display a message indicating that the browser is old or something like that, otherwise, execute the…
Afshin Mehrabani
  • 28,405
  • 26
  • 117
  • 186
16
votes
2 answers

Whole web app in C++ with DOM interaction

I have recently heard of compiling C++ code to javascript using emscripten and how, if asmjs optimizations are done, it has the potential of running applications really fast. I have read several post, tutorial and even heard some very interesting…
Javier Mr
  • 1,820
  • 2
  • 28
  • 35
14
votes
1 answer

writing asm.js by hand

I am trying to add asm.js annotations to the perlin simplex noise function: "use strict"; // Ported from Stefan Gustavson's java implementation // http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf // Read Stefan's excellent paper for…
Will
  • 68,898
  • 35
  • 156
  • 231
13
votes
3 answers

Slow javascript execution in IE11 until developer tools are enabled

I have a very large javascript application, which contains mostly asm.js code (it's built upon urho3d c++ engine which is them compiled into asm.js). It runs great on most browsers (chrome, firefox, safari, edge) but is extremely slow on IE11. The…
Alexey
  • 6,550
  • 3
  • 44
  • 63
13
votes
4 answers

What is this asm style "x | 0" some javascript programmers are now using?

I've seen some performance critical javascript code, like the one on this project that makes extensive use of bitwise OR operations with 0. Ex: GameBoyAdvanceCPU.prototype.write8 = function (address, data) { address = address | 0; data = data |…
13
votes
2 answers

What "use asm" does exactly?

As far as I know, Asm.js is just a strict specification of JavaScript, it uses the JavaScript features and it's not a new language. For instance, instead of using var a = e;, it offers var a = e|0;. My question is, if asm.js is just a definition and…
Afshin Mehrabani
  • 28,405
  • 26
  • 117
  • 186
12
votes
2 answers

Finalizers for JavaScript objects

Suppose I have some asm.js code, probably created by emscripten. Suppose it has some kind of rather large heap allocated structure, which gets returned by a asm.js function as a pointer that is picked up by some JavaScript library to be wrapped in a…
MvG
  • 51,562
  • 13
  • 126
  • 251
11
votes
2 answers

Unity/WebGL and asm.js related crash in MS Edge

I have a very basic Unity app that's essentially a test harness for a proprietary framework. It runs fine in Chrome, Firefox and Safari. Edge is a different story. In Edge 12, with asm.js disabled, it takes a very long time to load - roughly 90…
Daniel Schaffer
  • 52,912
  • 28
  • 108
  • 161
1
2 3
8 9