Native C++23 PHP extension porting pocketmine\math (Vector3, Vector2, AxisAlignedBB, Matrix,
Facing, VoxelRayTrace, …). Drop-in replacement for the composer package: same FQCNs, same
signatures, real public properties.
What it's for: all the game geometry — entity positions, collision boxes (AABB), ray tracing (picking the block you look at), movement math. These run millions of times per tick, so moving them to compiled code is the single biggest CPU win on a busy server.
| Operation | PHP | Native | Speedup |
|---|---|---|---|
| Vector3::add | 103 ns | 57 ns | 1.8× |
| Vector3::distanceSquared | 46 ns | 27 ns | 1.7× |
| Vector3::getSide | 156 ns | 54 ns | 2.9× |
| Vector3::floor | 172 ns | 46 ns | 3.7× |
| AABB::intersectsWith | 63 ns | 31 ns | 2.0× |
| AABB::calculateXOffset | 53 ns | 33 ns | 1.6× |
| AABB::calculateIntercept | 1100 ns | 104 ns | 10.6× |
| VoxelRayTrace (~20 blocks) | 4576 ns | 2316 ns | 2.0× |