Skip to content

[features] NormalEstimationOMP possible optimization #6159

@roncapat

Description

@roncapat

Is your feature request related to a problem? Please describe.

Code using NormalEstimationOMP built with PCL 1.14, RelWithDebInfo + -march=native.
Profiled with perf, I see that around 30% of the time spent is calling pcl::isFinite().
image

Context

Trying to compute cloud normals with NormalEstimationOMP at a predetermined loop rate for traversability estimation purposes (autonomous navigation).

Expected behavior

Some time savings, like the possibility to precompute isFinite() once and looking it up when needed.

Current Behavior

for (; xEnd != yEnd; idx += skip, xEnd += input_->width)
{
for (; idx < xEnd; ++idx)
{
if (!mask_[idx] || !isFinite ((*input_)[idx]))
continue;

here isFinite is called for every point in the RadiusSearchBox: this also means that a point may be checked multiple times!

for (const auto &index : indices)
{
if (!isFinite (cloud[index]))
continue;

here we call again isFinite.

Both the above linked codepaths are called by NormalEstimationOMP.

Describe the solution you'd like

Both the above linked codepaths are called by NormalEstimationOMP. This means that we may choose to pre-compute over the whole cloud an isFinite matrix/mask, propagate it to both code snippets above to look up such values.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions