Closed AkmalFairuz closed 2 months ago
This is ridiculous but true (and more than 30%).
$x*2
0.6087791919708252
and $x$x
0.2943990230560303
With a Windows 11 php 8.2.11, i7-12700kf
So more than 50%
This is ridiculous but true (and more than 30%).
$x*2
0.6087791919708252
and $x$x0.2943990230560303
With a Windows 11 php 8.2.11, i7-12700kf So more than 50%
That's 2x faster.
I also tested locally using an i5 10400F CPU, here are the results:
$x**2
float(27)
float(1.1193900108337402)
$x*$x
float(27)
float(0.5409140586853027)
It's really 2 times faster. $x**2 is often used in PM, especially in the Vector3->distanceSquared()
method
I have no opposition to this, just noting that distanceSquared
doesn't seem to be a hot path.
Using $x**2
Using $x*$x