-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
[FR] No bounds checks when NDEBUG flag is set #2420
Comments
Closed by #2423 |
@SteveBronder @bbbales2 so I need to set CXXFLAGS += -DSTAN_NO_RANGE_CHECKS and that escapes the range and size checks only? |
I don't think there's a guarantee that we are turning off every range and size check, but we're hopefully turning off enough that it counts performance-wise. |
And yeah, it's only range and size checks. All value checks should still be there. |
Cool cool. I would add a makefile helper so that STAN_NO_RANGE_CHECKS=true adds |
Oh whoops, I thought this was somehow done automagically. I'll add to my list for today and if I don't get to it I'll open an issue for later. |
Sure thing. For STAN_THREADS for example we do this: Line 282 in 9895be8
|
Description
From #853 in stanc3 we recently reverted a check where the compiler actually avoided bounds checks on single indexing functions. This can have a pretty bad performance hit so I think now would be a good time to do something like #2255 where when NDEBUG is set bounds checks are a no-op. This is a standard no debug flag in C++ and is used by boost, eigen, and the standard library to turn off bounds checking. So I think its reasonable that if a user has it set they expect to not have these checks
Example
Expected Output
Bounds checks are not turned on
Current Version:
v4.0.1
The text was updated successfully, but these errors were encountered: