-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
PCL RFC 0002: Better type for indices
Kunal Tyagi edited this page Jan 20, 2020
·
8 revisions
- Title: PCL-RFC-0002: Better type for indices
- Author: kunaltyagi
- Gitter room: PointCloudLibrary/PCL-RFC-02
- Past discussion: #3351
- People of Interest: jasjuang, aPonza, taketwo, SergioRAgostinho
Currently, there's mixed use of int
, long
, unsigned int
, unsigned long
, unsigned long long
and std::size_t
for indices. Some effort has been made to unify towards std::size_t
to reduce the limit of 2 billions points due to int
.
Using pcl::index_t
as a compile time configurable alias (default: std::intN_t
or std::ptrdiff_t
) would make PCL algorithms work with point clouds of any size.
- Follows a best practice (as defined in the (Guideline Support Library aka GSL)
- Potentially allows operations on actually limitless points (if using 64 bit systems)
- Allow the user to choose a custom/larger platform independent/dependent index size
- One of the following complication (if we use use
GSL
'sindex_t
):- Extra build-time dependency on internet
- Copy-pasted source file
-
git
sub-tree/sub-module
- Wastes memory: Largest RAM supported is ~32TB (2^48). That's a clear 25% loss of efficiency for extreme cases, and larger for average use-case. Though this is negated by the explicit choice made by user before compilation.
- None for existing internal migration
- Major API breakage for changing
Indices
fromstd::vector<int>
tostd::vector<index_t>
Minor to medium, split over multiple phases:
- Internal API modification is underway, would need modification from
std::size_t
topcl::index_t
- Modification of public API will be faster since it is easily identifiable (function declaration, data members)
Multi-step migration:
- Replace
std::vector<int>
withIndicesVec
- Replace
std::size_t
withpcl::index_t
- Replace
IndicesVec = std::vector<int>
withIndicesVec = std::vector<pcl::index_t>