asm.js is a subset of JavaScript designed to allow computer software written in languages such as C to be run as web applications while maintaining performance characteristics considerably better than standard JavaScript, which is the typical language used for such applications.
via Wikipedia infobox
asm.js
asmjs.org →This specification defines asm.js , a strict subset of JavaScript that can be used as a low-level, efficient target language for compilers. This sublanguage effectively describes a sandboxed 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. This specification is working towards a candidate draft for asm.js version 1. Mozilla's SpiderMonkey JavaScript engine provides an optimizing implementation of this draft. 18 August 2014 better "putting it all together" example 23 July 2014 formatting cleanups added variadic function types to the Global Types section 22 July 2014 clarified formal structure with explicit validation rule names moved function table validation from annotations section to validation section separated case and default validation rules eliminated unused expected case type parameter corrected type checks to subtype checks in AdditiveExpression , BitwiseXORExpression , BitwiseANDExpression , BitwiseORExpression , and ConditionalExpression 8 July 2014 minor editorial bugfixes non-function foreign imports are mut tightened the language on linking restrictions 7 July 2014 added 32-bit floating point types renamed doublish to double? for symmetry with float? separated heap access checking into a separate validation section separated load and store types for heap views added Math.fround and singleton fround type added a Float Coercions section added uncoerced CallExpression nodes to Expression for float coercions added float coercions to initializers, return type annotations, and legal function calls added restriction preventing float coercions of FFI calls added float support for operators and Math functions added float to legal result types for ConditionalExpression added variadic Math.min and Math.max eliminated the allowance for 1-byte views to elide their index shift (to future-proof for large heaps) simplified and generalized link-time restrictions on heap size 12 December 2013 return type of Math.abs is signed 11 October 2013 unsigned is not an extern type added missing ! operator to UnaryExpression operators added note about ~~ to Unary Operators section added note about parenthesis agnosticism to Syntax section added note about ASI to Syntax section added - NumericLiteral cases everywhere function calls require explicit coercions eliminated type unknown , which is no longer needed return type of integer % is intish This specification defines asm.js, a strict subset of JavaScript that can be used as a low-level, efficient target language for compilers. The asm.js language provides an abstraction similar to the C/C++ virtual machine: a large binary heap with efficient loads and stores, integer and floating-point arithmetic, first-order function definitions, and function pointers. The asm.js programming model is built around integer and floating-point arithmetic and a virtual heap represented as a typed array . While JavaScript does not directly provide constructs for dealing with integers, they can be emulated using two tricks: integer loads and stores can be performed using the typed arrays API; and integer arithmetic is equivalent to the composition of JavaScript's floating-point arithmetic operators with the integer coercions performed by the bitwise operators. The shift converts the byte offset to a 32-bit element offset, and the bitwise coercion ensures that an out-of-bounds access is coerced from undefined back to an integer. This programming model is directly inspired by the techniques pioneered by the Emscripten and Mandreel compilers. This explicit directive allows JavaScript engines to avoid performing pointless and potentially costly validation on other JavaScript code, and to report validation errors in developer consoles only where relevant. Because asm.js is a strict subset of JavaScript, this specification only defines th
~9 min read
asm.js is a subset of JavaScript designed to allow computer software written in languages such as C to be run as web applications while maintaining performance characteristics considerably better than standard JavaScript, which is the typical language used for such applications.
asm.js consists of a strict subset of JavaScript, to which code written in statically typed languages with manual memory management (such as C) is translated by a source-to-source compiler such as Emscripten (based on LLVM). Performance is improved by limiting language features to those amenable to ahead-of-time optimization and other performance improvements.
Excerpt from a page describing this subject · 40,000 chars · not written by Vinony
The spec repo hosts the source for the current asm.js Working Draft. This repo hosts JS source code which performs asm.js validation, however as of this update, this code is not up to date with the latest working draft and is not extensively tested. Patches to update it or fix bugs are welcome though.
Excerpt from the source-code README · 2,431 chars · not written by Vinony
via Wikidata · CC0
Discovered by embedding cosine similarity (sentence-transformers MiniLM, 384-dim).