Super funny thing is that Octane/box2d frequently executes this operation without setting valueOf / toString...
We need to consider how to optimize it. Preliminary experiment, just converting CompareGearterEq/CompareLessEq(FinalObject, FinalObject) => FinalObject Checks and JSConstant(true) improves box2d 8.9%. (Of course, it is not valid conversion. But box2d does not set valueOf / toString, so it does not change the result.) box2d x2 12.88978+-0.30108 ^ 11.83268+-0.29723 ^ definitely 1.0893x faster
(In reply to Yusuke Suzuki from comment #1) > We need to consider how to optimize it. Preliminary experiment, just > converting CompareGearterEq/CompareLessEq(FinalObject, FinalObject) => > FinalObject Checks and JSConstant(true) improves box2d 8.9%. (Of course, it > is not valid conversion. But box2d does not set valueOf / toString, so it > does not change the result.) > > box2d x2 12.88978+-0.30108 ^ 11.83268+-0.29723 ^ > definitely 1.0893x faster In addition, we can find CompareLess(FinalObject, FinalObject). If we can convert it to false, we can achieve 13% improvement. baseline patched box2d x2 13.26226+-0.39901 ^ 11.73540+-0.39178 ^ definitely 1.1301x faster