tesseract icon indicating copy to clipboard operation
tesseract copied to clipboard

Leverage forward declarations to improve compile times

Open Levi-Armstrong opened this issue 1 year ago • 19 comments

This cuts the build time from 4 minutes and 30 seconds to 2 minutes and 45 seconds.

Levi-Armstrong avatar Feb 22 '24 01:02 Levi-Armstrong

Are the fwd.h headers not problematic by declaring a bunch of classes that don't necessarily get used in each source file? Why not just declare the specific classes that each header needs to reference?

marip8 avatar Feb 22 '24 15:02 marip8

Are the fwd.h headers not problematic by declaring a bunch of classes that don't necessarily get used in each source file?

It is not because you can declare things as many time as you want but you can only have one define it once.

Why not just declare the specific classes that each header needs to reference?

Because forward declaration can be problematic especially when using in template classes, so it is encouraged that developers provide this file to let users know what types are okay to use as forward declarations. An example of this is the #include <iosfwd> provided by the standard libraries to avoid having IO headers in your headers.

Levi-Armstrong avatar Feb 22 '24 19:02 Levi-Armstrong

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 90.17%. Comparing base (d361f7d) to head (fccd356).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #990      +/-   ##
==========================================
- Coverage   90.91%   90.17%   -0.74%     
==========================================
  Files         280      280              
  Lines       15876    15701     -175     
==========================================
- Hits        14434    14159     -275     
- Misses       1442     1542     +100     

see 181 files with indirect coverage changes

codecov[bot] avatar Mar 08 '24 21:03 codecov[bot]

@johnwason Would you have time to look into what the issue is with the windows test failures?

Levi-Armstrong avatar Mar 09 '24 03:03 Levi-Armstrong

Why not just use precompiled headers instead of reworking everything?

johnwason avatar Mar 09 '24 19:03 johnwason

Why not just use precompiled headers instead of reworking everything?

At this point I am almost finished updating everything.

Levi-Armstrong avatar Mar 10 '24 16:03 Levi-Armstrong

@Levi-Armstrong my fixes didn't work... go ahead and force push to revert my last two commits.

johnwason avatar Mar 10 '24 20:03 johnwason

I am not seeing the serialization unit test failures locally. I am seeing issues with the static loader plugin tests.

johnwason avatar Mar 10 '24 20:03 johnwason

@johnwason This may be related.

Levi-Armstrong avatar Mar 11 '24 03:03 Levi-Armstrong

I am not seeing the serialization unit tests locally. I am investigating but so far don't have an explanation. Maybe try clearing the github action cache completely?

johnwason avatar Mar 11 '24 17:03 johnwason

Can I manually clear the cache?

Levi-Armstrong avatar Mar 11 '24 18:03 Levi-Armstrong

You can see all the caches here: https://github.com/tesseract-robotics/tesseract/actions/caches

Not sure how to "clear all" though

johnwason avatar Mar 11 '24 18:03 johnwason

I updated to the newest vcpkg boost version and now I am seeing the test failures. I will keep trying to trace the error.

johnwason avatar Mar 11 '24 19:03 johnwason

Looking at the CI, the Conda Windows CI is working with Boost 1.82, while the vcpkg Windows build is failing with Boost 1.84. This may be a problem with Boost 1.84.

johnwason avatar Mar 11 '24 21:03 johnwason

Yeah I am seeing the same failures on the scheduled builds on master. This looks like a boost problem.

johnwason avatar Mar 11 '24 21:03 johnwason

I ran a matrix build of different boost versions, and only 1.84 is failing. https://github.com/johnwason/tesseract/actions/runs/8242279639/job/22540993793

I set the vcpkg revision to use boost 1.83. I recommend opening an issue with boost serialization.

johnwason avatar Mar 12 '24 16:03 johnwason

@johnwason I believe I removed your change when I force pushed. What change do I need to make to pin the version?

Levi-Armstrong avatar Mar 18 '24 01:03 Levi-Armstrong

@Levi-Armstrong I pushed the commit

johnwason avatar Mar 18 '24 01:03 johnwason

See boost/serialization issue https://github.com/boostorg/serialization/issues/309

johnwason avatar Mar 18 '24 01:03 johnwason