aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-05-03 12:09:37 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-05-03 12:29:23 -0700
commit77aa2a72f38d73e71eef48cacfe72cce33fc7201 (patch)
tree6dd3e801732e0aa3307e2af370eabd1c8570e207 /src
parent2308587a85de571844e71e574fcc63c7955d6012 (diff)
emit a global const for Math_fround(0) to avoid function call overheads in the fround polyfill
Diffstat (limited to 'src')
-rw-r--r--src/settings.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/settings.js b/src/settings.js
index a9a72425..3289eace 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -124,13 +124,20 @@ var PRECISE_I32_MUL = 1; // If enabled, i32 multiplication is done with full pre
var PRECISE_F32 = 0; // 0: Use JS numbers for floating-point values. These are 64-bit and do not model C++
// floats exactly, which are 32-bit.
// 1: Model C++ floats precisely, using Math.fround, polyfilling when necessary. This
- // can be slow if the polyfill is used on heavy float32 computation.
+ // can be slow if the polyfill is used on heavy float32 computation. See note on
+ // browser support below.
// 2: Model C++ floats precisely using Math.fround if available in the JS engine, otherwise
// use an empty polyfill. This will have much less of a speed penalty than using the full
// polyfill in cases where engine support is not present. In addition, we can
// remove the empty polyfill calls themselves on the client when generating html,
// which should mean that this gives you the best of both worlds of 0 and 1, and is
// therefore recommended.
+ // XXX Note: To optimize float32-using code, we use the 'const' keyword in the emitted
+ // code. This allows us to avoid unnecessary calls to Math.fround, which would
+ // slow down engines not yet supporting that function. 'const' is present in
+ // all modern browsers, including Firefox, Chrome and Safari, but in IE is only
+ // present in IE11 and above. Therefore if you need to support legacy versions of
+ // IE, you should not enable PRECISE_F32 1 or 2.
var SIMD = 0; // Whether to emit SIMD code ( https://github.com/johnmccutchan/ecmascript_simd )
var CLOSURE_COMPILER = 0; // Whether closure compiling is being run on this output