Skip to content

[SAMPLE_CONSENSUS] Optimize Ellipse3D build performance with extern templates and logic relocation#6439

Open
AlrIsmail wants to merge 1 commit intoPointCloudLibrary:masterfrom
AlrIsmail:refactor/ellipse3d-math-relocation-extern-templates
Open

[SAMPLE_CONSENSUS] Optimize Ellipse3D build performance with extern templates and logic relocation#6439
AlrIsmail wants to merge 1 commit intoPointCloudLibrary:masterfrom
AlrIsmail:refactor/ellipse3d-math-relocation-extern-templates

Conversation

@AlrIsmail
Copy link
Copy Markdown
Contributor

@AlrIsmail AlrIsmail commented May 7, 2026

This PR is a continuation of #6430 and a more detailed investigation of @larshg's commit, which relocates internal large math logic from the header to the source file and implements extern template declarations for SampleConsensusModelEllipse3D.

Impact

ClangBuildAnalyzer reports :
baseline.txt -> opt.txt

Metric Baseline (Inline) Optimized (Extern) Delta
Codegen 281.4 s 275.8 s -5.6 s
Parsing 173.7 s 172.4 s -1.3 s
Compilation Time (Unit Test) 21.5 s 14.2 s -7.3 s
Ellipse3D Source Build 35.9 s 35.1 s -0.8 s
Runtime (100 RANSAC runs) 8.33 ms 8.23 ms -0.1 ms

Signed-off-by: Ismail <ismailalri@gmail.com>
@mvieth
Copy link
Copy Markdown
Member

mvieth commented May 9, 2026

Thank you for the pull request, but I do not see any improvement in build times when I do the measurements:

master         new
13m51.421s     13m53.709s       everything up to and including test_quadric_models, gcc
 9m37.505s      9m37.639s       pcl_sample_consensus, gcc
 0m27.086s      0m26.738s       test_quadric_models, gcc
 0m51.993s      0m52.695s       only ellipse3d.cpp, gcc
 0m50.178s      0m50.271s       only ellipse3d.cpp, clang
 7m8.413s       7m11.149s       pcl_sample_consensus, clang
 0m19.962s      0m19.446s       test_quadric_models, clang
 0m17.814s      0m18.138s       test_quadric_models, clang

It seems like you are basing your metrics on only two runs of the clang build analyzer? One for the baseline, once for the changed version? That is not very robust. The differences in build time could easily be due to randomness. In fact, many files have faster build times in opt.txt than in baseline.txt, which cannot be explained by your changes to sac_model_ellipse3d.h and sac_model_ellipse3d.cpp. Perhaps you computer had other background processes running while building the baseline, and was slower du to that.

@AlrIsmail
Copy link
Copy Markdown
Contributor Author

It's actually strange that you don't see improvement or maybe beacue i'm on an arm64 architecture?

As to respond to your question, I did do a couple of runs of clang build analyzer, but didn't stress test it (is the clang build analyzer susceptible to noise ?)
And so I redid a 10-run cold-cache benchmark suite (42 times compilation each) to make sure, and I still get the improvements (those are averages):
Parsing: 133.6s → 125.2s (-8.4s savings)
Codegen: Delta of -1.8s (within noise)

Do you have a more accurate way to test it if we are not sure of the results?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants