Reduce Boost dependency footprint - #3356
Conversation
|
Funny, I was just talking to someone today about decreasing our reliance on boost/random Can we add any new libraries to the trim list Lines 117 to 120 in cc6ba8b after this? |
| // alpha < 1 makes this distribution's tail very sparse, so most of the K | ||
| // bins have expected counts far below N; a single sample landing in one | ||
| // of them can dominate the statistic. Pool bins so each group has an | ||
| // expected count of at least 5, per standard chi-square goodness-of-fit | ||
| // practice. Grouping is based only on the theoretical expected counts | ||
| // (not the realized samples), so it doesn't bias the test. |
There was a problem hiding this comment.
You can add this hook to your claude and it stops it from doing these multi line comments
https://gist.github.com/SteveBronder/8c2f141fed4511447a8ad5939157857e
Generally I have seen that if you let it start writing a lot of these it uses them as an excuse to do bad code. The comment can also be wrong since it is untested which can lead to other agents down the road getting confused here.
There was a problem hiding this comment.
Oh super cool, immediately stolen
|
From the tests it seems like the changes in |
Summary
Including Boost headers outside of their Math library tends to pull in a surprising amount of other Boost headers.
For example, for the single
lexical_castcall ininit_threadpool_tbb()the total Boost footprint is:This PR removes three different types of Boost dependencies:
boost/lexical_cast(init_threadpool_tbb): Replaced with astd::from_chars+ try/catchboost/optional(hypergeometric_2F1): Replaced withstd::optionalboost/random(_rngfunctions): Replaced withstd::equivalents (e.g.,std::bernoulli_distribution bernoulli_rng)Tests
N/A - Existing tests should still pass.
Note that this triggered an edge-case with the expected-value (chi-square) testing for distributions, where too few values were sampled for particular bins. The testing util was updated to just merge bins if the expected counts were too low.
Side Effects
Possibility of changes to existing
_rngoutputs with same seed valueRelease notes
Replaced Boost dependencies with standard library equivalents
Checklist
Copyright holder: Andrew Johnson
The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
the basic tests are passing
./runTests.py test/unit)make test-headers)make test-math-dependencies)make doxygen)make cpplint)the code is written in idiomatic C++ and changes are documented in the doxygen
the new changes are tested