> On Jun 29, 2017, at 12:19 PM, Justin Mclean <jus...@classsoftware.com> wrote: > > Hi, > >> The JS version of the test is here: >> http://home.apache.org/~aharui/FlexJS/FLEX35330/bin/js-release/ >> <http://home.apache.org/~aharui/FlexJS/FLEX35330/bin/js-release/> >> The SWF version of the test is here: >> http://home.apache.org/~aharui/FlexJS/FLEX35330/bin-debug/ >> >> For me, the SWF version is considerably slower. The JS version can run a >> test in 200ms that takes Flash 12000ms! > > You might want to try a non debug version of the swf.
It’s still considerably slower. (See my last response.) > >> And for me, on both SWF and JS, I'm seeing that run as fast or faster for >> "boolean" as using strict equality: >> >> if (someObject === true) >> >> Do others see that? > > No but there’s not much in it. > > j = 0 if (initialisedBoolean) : 284 > j = 0 if (initialisedBoolean == true) : 309 > j = 0 if (initialisedBoolean === true) : 276 > j = 0 if (initialisedLocalBoolean) : 202 > j = 0 if (initialisedLocalBoolean == true) : 233 > j = 0 if (initialisedLocalBoolean === true) : 191 > > I don’t see any tests for uninitialisedBoolean’s and true in there. No idea what you looked at, but you should get something like this: 1000000 j = 0 if (uninitializedObject) : 409 j = 0 if (uninitializedObject != null) : 426 j = 0 if (uninitializedObject !== undefined) : 447 j = 0 if (initialisedObject) : 393 j = 0 if (initialisedObject != null) : 403 j = 0 if (initialisedObject !== null) : 415 j = 0 if (uninitialisedBoolean) : 429 j = 1000000 if (uninitialisedBoolean != false) : 440 j = 1000000 if (uninitialisedBoolean !== false) : 389 j = 0 if (initialisedBoolean) : 389 j = 0 if (initialisedBoolean == true) : 377 j = 0 if (initialisedBoolean === true) : 397 j = 0 if (unInitializedNumber) : 417 j = 0 if (!isNaN(unInitializedNumber)) : 439 j = 0 if (initializedNumber) : 457 j = 0 if (!isNaN(initializedNumber)) : 453 j = 0 if (uninitializedLocalObject) : 427 j = 0 if (uninitializedLocalObject != null) : 480 j = 0 if (uninitializedLocalObject !== undefined) : 424 j = 0 if (initialisedLocalObject) : 394 j = 0 if (initialisedLocalObject != null) : 408 j = 0 if (initialisedLocalObject !== null) : 376 j = 0 if (uninitialisedLocalBoolean) : 410 j = 0 if (uninitialisedLocalBoolean != false) : 401 j = 0 if (uninitialisedLocalBoolean !== false) : 398 j = 0 if (initialisedLocalBoolean) : 387 j = 0 if (initialisedLocalBoolean == true) : 379 j = 0 if (initialisedLocalBoolean === true) : 412 j = 0 if (unInitializedLocalNumber) : 411 j = 0 if (!isNaN(unInitializedLocalNumber)) : 452 j = 0 if (initializedLocalNumber) : 400 j = 0 if (!isNaN(initializedLocalNumber)) : 735 j = 0 if (bool1 == bool2) : 1177 j = 0 if (bool1 ? !bool2 : bool2) : 1438 j = 0 if ((bool1 ? 1 : 0) ^ (bool2 ? 1 : 0)) : 796 >> given that "if (someObject)" doesn't require boolean variable >> initialization > > Without initialisation you can get type conversion in some cases and it is > likely to be slower. Without initialisation you will also still have this > issue in that (undefined == false) is false which can cause a number of bugs. > Code like this (someBool == false) and (!someBool) will give different > results depending if you initialise the boolean to false or not. There are tests for both, and you DON’T get type conversions unless it’s required. Browsers are smarter than that. >> Again, we don't have to all agree. We can teach the compiler to do >> different things at different points. > > Sure. > > Thanks, > Justin