A questionable but faster MSVC compiler switch

/fp:fast

The related article :
1) https://blogs.msdn.microsoft.com/vcblog/2015/10/19/do-you-prefer-fast-or-precise/
2) https://blogs.msdn.microsoft.com/vcblog/2016/05/04/new-code-optimizer/

MSVC2012+ will generate more faster code using -fp:fast, especially on some intrinsic functions and Auto-Vectorization (/arch:SSE2, /arch:AVX?), but maybe this will produce wrong results because of reducing the accuracy.
So if we want to use the compiler switch, you should add some code to avoid the precision decrease.

#ifdef _MSC_VER
#pragma float_control(precise, on, push)
#endif

// Your higher precision code

#ifdef _MSC_VER
#pragma float_control(pop)
#endif

The code section will overwrite /fp:fast to /fp:precise, and very useful to apply for Mozilla code, because Mozilla use unified build to make the projects, it’s more trouble to change it in one source file.

Take Mozilla code for example, we can use -fp:fast on GFX code, and take the patch below.

diff --git a/gfx/2d/BasePoint4D.h b/gfx/2d/BasePoint4D.h
--- a/gfx/2d/BasePoint4D.h
+++ b/gfx/2d/BasePoint4D.h
@@ -6,16 +6,20 @@
#ifndef MOZILLA_BASEPOINT4D_H_
#define MOZILLA_BASEPOINT4D_H_

#include "mozilla/Assertions.h"

namespace mozilla {
namespace gfx {

+#ifdef _MSC_VER
+#pragma float_control(precise, on, push)
+#endif
+
/**
* Do not use this class directly. Subclass it, pass that subclass as the
* Sub parameter, and only use that subclass. This allows methods to safely
* cast 'this' to 'Sub*'.
*/
template
struct BasePoint4D {
union {
@@ -120,12 +124,16 @@ struct BasePoint4D {

void Normalize() {
*this /= Length();
}

bool HasPositiveWCoord() { return w; }
};

+#ifdef _MSC_VER
+#pragma float_control(pop)
+#endif
+
} // namespace gfx
} // namespace mozilla

#endif /* MOZILLA_BASEPOINT4D_H_ */

And in the same time, we also can use the code section below to overwrite /fp:precise to /fp:fast

#ifdef _MSC_VER
#pragma float_control(precise, off, push)
#endif

// Your lower precision code

#ifdef _MSC_VER
#pragma float_control(pop)
#endif
更高

pcxFirefox 49.0.1 is Released

Follow official edition changes
Download pcxFirefox

Built using VC2015 since this edition.

Compatible Changes different from Official Edition
1) Remove the plugin restriction in x64 edition ( back out Bug 1165981 )
2) Restore distribution/bundles support ( back out Bug 1144127 )
3) Restore general.useragent.override.[domain] support ( back out Bug 896114 )

Add two about:config
1) pref(“pcxfirefox.processpriority.firefox.timer”, 30);
Delayed time : seconds
2) pref(“pcxfirefox.processpriority.firefox.level”, 1);
Level 0 NORMAL_PRIORITY_CLASS
Level 1 ABOVE_NORMAL_PRIORITY_CLASS
Level 2 HIGH_PRIORITY_CLASS

About disable extension signing check
Because of Mozilla some changes ( I haven’t worked it out yet ), if you migrate from the same official edition to my build, you can’t enable the disabled unsigned extensions, when you notice that, you can enter about:config and toggle xpinstall.signatures.required option some times, then the disabled extensions will be enabled. If you update your edition from my older build, you don’t need toggle the option.

pcxFirefox 49.0 with new tmemutil module

Follow official edition changes
Download pcxFirefox

Built using VC2015 since this edition and package the new tmemutil module : https://pcxfirefox.wordpress.com/2016/09/22/tmemutil-for-pcxfirefox-20160922/

Compatible Changes different from Official Edition
1) Remove the plugin restriction in x64 edition ( back out Bug 1165981 )
2) Restore distribution/bundles support ( back out Bug 1144127 )
3) Restore general.useragent.override.[domain] support ( back out Bug 896114 )

Add two about:config
1) pref(“pcxfirefox.processpriority.firefox.timer”, 30);
Delayed time : seconds
2) pref(“pcxfirefox.processpriority.firefox.level”, 1);
Level 0 NORMAL_PRIORITY_CLASS
Level 1 ABOVE_NORMAL_PRIORITY_CLASS
Level 2 HIGH_PRIORITY_CLASS

About disable extension signing check
Because of Mozilla some changes ( I haven’t worked it out yet ), if you migrate from the same official edition to my build, you can’t enable the disabled unsigned extensions, when you notice that, you can enter about:config and toggle xpinstall.signatures.required option some times, then the disabled extensions will be enabled. If you update your edition from my older build, you don’t need toggle the option.