PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
9.93k stars 4.61k forks source link

[cmake] Adding support for PCH and Unity builds (using Cotire/CMake 3.16) #649

Open nh2 opened 10 years ago

nh2 commented 10 years ago

Have a look at https://github.com/sakra/cotire, it can speed up the build of a CMake project with low effort (by using precompiled headers).

When compiling an example like the extract_indices tutorial, precompiled headers brought down my compile time from 6s to 1.8.

For this example, with g++ -H I found that it includes over 3900 header files. A precompiled header reduces that to 1.

Note that cotire doesn't seem to be able to share precompiled headers across files so far, so it might not be able to help when doing just a single full build once, but it seems like it can dramatically improve build speeds when developing.

The speedup [doesn't seem to work with clang] right now though.

taketwo commented 10 years ago

Thanks for sharing this, I didn't know about cotire, but it looks rather promising. I am not very proficient with cmake and the ins and outs of PCL build system, so not sure how realistic it is to integrate cotire. Hopefully someone more knowledgeable will comment on this.

nizar-sallem commented 10 years ago

It is not the right place for it, we us ccache which allows for the same speed up but doesn't require to modify the build system. I prefer this kind of solution to cotire since it replaces the compiler. It would be interesting to ask ITK to include cotire in cmake rather than ask us to support it. That is my opinion.

nh2 commented 10 years ago

@nizar-sallem Unfortunately ccache doesn't help speeding up the include cost of massive C++ template libraries.

stale[bot] commented 4 years ago

Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.

nh2 commented 4 years ago

Just to be very clear, a stale bot is a very poor idea and you will lose contributors this way. PCL has lots of long-standing problems, and they won't go away by themselves after 30 days.

Most people, including me, are also not going to come here every 30 days to "renew" their issues. If every project did this, as a contributor to many projects, I'd have to renew tens of issues every day.

kunaltyagi commented 4 years ago

Most people are also not going to come here every 30 days to "renew" their issues

We know that. We'd be re-labelling issues as well fine-tuning the stale-bot config to ensure this doesn't happen.

Eg: We're not excluding issues with kind: todo right now, because, ... well, it didn't cross my mind when I updated the configuration to find badly labelled issues.

kind: todo is simply backlog for the maintainers and is a no-brainer to add to stalebot. kind: proposal on the other hand is more difficult, because maintainers have only a limited time, and I like the idea for the topic to get either a Aye/Nay vote without a month of inactivity. Since the maintainers have only a limited bandwidth, community contributions and PR on these issues labelled with kind: proposal would be amazing.

kunaltyagi commented 4 years ago

We can get the discussion restarted, esp wrt:

nh2 commented 4 years ago

From my experience with Cotire and CMake's builtin support for PCH and unity builds:

kunaltyagi commented 4 years ago

You seem to imply that you've got a version of PCH-enabled PCL. Did you manage to measure the improvement due to Unity build too?

nh2 commented 4 years ago

You seem to imply that you've got a version of PCH-enabled PCL. Did you manage to measure the improvement due to Unity build too?

Unfortunately I don't have that. For the experiment in the issue description in 2014

When compiling an example like the extract_indices tutorial, precompiled headers brought down my compile time from 6s to 1.8.

I had manually compiled a precompiled header for the extract_indices program and measured with that.

kunaltyagi commented 4 years ago

Personally speaking, I liked this idea, and tried to experiment, but I don't have CMake skills to achieve this. Could you take a swing at it?

nh2 commented 4 years ago

I don't think I qualify for

requires somebody with good overview across the breadth of PCL to compose the PCH

as I've mainly worked with KinFu.

I also don't currently have any work involving PCL any more, but I could take a shot at unity builds next time I do (I cannot predict when that will be though).

kunaltyagi commented 4 years ago

I don't think a lot of people do. If you start from GPU and CUDA modules, others can copy from it.

I cannot predict when that will be though

No issues. Putting this on back-burner