07-14-2017, 10:37 PM
I think we're long overdue for this discussion. Do we prefer passing coords between functions as three (or six) int params, or as a Vector3 / cCuboid / cBoundingBox?
There's a problem with int-based approach, especially when specifying ranges - some of the functions take the (MinX, MaxX, MinY, MaxY, MinZ, MaxZ) ordering and some the (MinX, MinY, MinZ, MaxX, MaxY, MaxZ) ordering, creating a great opportunity for subtle bugs.
On the other hand, we don't know if using the object-based approach has any performance implications on some platforms. We know that on x64 the Vector3i may actually be faster than three ints [1], but we have no idea about ARM. Can someone provide some insight / benchmarks?
So, the question is, should we change all the code to use objects, or drop the objects completely, or keep doing what we're doing now (no guidance at all)?
Ref.:
[1]: https://github.com/cuberite/cuberite/pul...r125324633
There's a problem with int-based approach, especially when specifying ranges - some of the functions take the (MinX, MaxX, MinY, MaxY, MinZ, MaxZ) ordering and some the (MinX, MinY, MinZ, MaxX, MaxY, MaxZ) ordering, creating a great opportunity for subtle bugs.
On the other hand, we don't know if using the object-based approach has any performance implications on some platforms. We know that on x64 the Vector3i may actually be faster than three ints [1], but we have no idea about ARM. Can someone provide some insight / benchmarks?
So, the question is, should we change all the code to use objects, or drop the objects completely, or keep doing what we're doing now (no guidance at all)?
Ref.:
[1]: https://github.com/cuberite/cuberite/pul...r125324633