Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building time of a project which depends on PCL is too long #4690

Closed
MBSadeghzadeh opened this issue Apr 4, 2021 · 8 comments
Closed

Building time of a project which depends on PCL is too long #4690

MBSadeghzadeh opened this issue Apr 4, 2021 · 8 comments
Labels
kind: question Type of issue

Comments

@MBSadeghzadeh
Copy link

I have created a project in visual studio 2015 and installed PCL 1-8-0. I have included

#include <pcl/point_cloud.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/filters/passthrough.h>
#include <pcl/common/transforms.h>
#include <pcl/filters/crop_box.h>
#include <pcl/filters/voxel_grid.h>

and when I change any header file of mine, it takes a long time to build the project. Rebuilding the project also gets a huge time.
Is there any way to get rid of this?

@MBSadeghzadeh MBSadeghzadeh added the status: triage Labels incomplete label Apr 4, 2021
@MBSadeghzadeh MBSadeghzadeh changed the title Building time of a project which depends on PCL is so long Building time of a project which depends on PCL is too long Apr 4, 2021
@mvieth
Copy link
Member

mvieth commented Apr 4, 2021

Yes, building a project that uses PCL takes a bit of time. How much time does it take for you (roughly)?
Keep in mind that when you change a header file, every file that includes that header file has to be rebuilt.
There are a few things you can try to reduce your build time:

  • only include those files you really need. There is a cool tool that helps you identify unnecessary includes called "include-what-you-use". Not sure it runs under Windows though (assuming you use Windows)
  • parallelize your builds (more than one build job). With make this works with make -j2 for 2 jobs, for example. I don't know about visual studio, but there is probably a similar option there
  • modularize your project. If you modify a file, that file and every file that depends on that file has to be rebuilt. If you split your project into several header and implementation (.cpp) files, less code has to be recompiled when you make a change. Your headers should be a small as possible
  • switching to the newest PCL version might save you some time during building
  • if you turned the optimization in your compiler on, that will also make your build slower. Consider when you want a fast build and when you want an optimized program
  • if you use cmake, you should request only those components/modules you need in the find_package command (see here)

@mvieth mvieth added kind: question Type of issue and removed status: triage Labels incomplete labels Apr 5, 2021
@MBSadeghzadeh
Copy link
Author

I get more than 30 thousands of compiler warnings. May it lead to slowness?

@MBSadeghzadeh
Copy link
Author

The IntelliSense also gets ridiculously slow.

@kunaltyagi
Copy link
Member

kunaltyagi commented Apr 22, 2021

Please submit questions and bug reports requests about IntelliSense to IntelliSense :)

@MBSadeghzadeh
Copy link
Author

But build also is slow. It takes me several minutes each time to build.

@kunaltyagi
Copy link
Member

Answered above by mvieth. Please feel free to contribute to reduce the build time. Closing the issue since it's:

@larshg
Copy link
Contributor

larshg commented Apr 22, 2021

Visual studio is just slow, when working with projects like PCL, probably due to heavy use of templates, boost headers, eigen headers, optional qt etc. And the fact that its a huge library.

If my memory recalls me it parses more than 200.000 files.

You could try change this setting:
image

That might help with intellisense, which is indeed awfully slow. I have just changed this setting myself and it seems more responsive, however as I understood, only to files you have included in the project. ie. not everyone available in additional include folders, so it cannot suggest you to include new header files, if you write a class name etc.

I don't know how easy it is to optimize the build times, except having mutiple .cpp files, so the entire app doesn't have to be recompiled, but only subparts of it.

@larshg
Copy link
Contributor

larshg commented Apr 22, 2021

Ohh, I'm not sure if this setting is available in VS2015 though, I use VS2019.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: question Type of issue
Projects
None yet
Development

No branches or pull requests

4 participants