Skip to content

Doc: does NDEBUG change anything in optimized builds? #2387

@m-burst

Description

@m-burst

According to the performance documentation,

In C/C++, the NDEBUG pre-processor directive is not set by default. When it is not set, the simdjson library does many additional checks that may impact negatively the performance. We recommend that, once your code is well tested, you define NDEBUG directive in your Release builds. The NDEBUG directive should be defined prior to including the simdjson.h header.

The NDEBUG directive is generally independent from optimization flags. For example, setting -O3 under GCC does not set the NDEBUG directive.

However, the only mention of NDEBUG I could find in the source code is in the portability.h file, where the preprocessor result would be the same with NDEBUG and with __OPTIMIZE__.

Is this an inconsistency in the documentation, or are there some other checks in the source which are controlled by NDEBUG?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions