Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[C++] Unnecessary overhead added with precedence checks #1032

@szymonwieloch

Description

@szymonwieloch

When you enable precedence checks (sbe.enable.precedence.checks=true), the generated code is supposed to be managed using the SBE_ENABLE_PRECEDENCE_CHECKS macro. The expectation is that with this flag enabled, precedence check should be enabled and with this flag NOT enabled there should be no overhead and the code should be usable in production. However upon inspection it seems that the code does have some overhead also when the macro is disabled. For example the m_codeState and corresponding pointers in the group wrappers do add some overhead. Currently user has three different options of code generation:

  1. sbe.enable.precedence.checks=false - the "standard" version without any overhead and no checks
  2. sbe.enable.precedence.checks=true and the SBE_ENABLE_PRECEDENCE_CHECKS macro enabled - debug only version with checks and significant overhead
  3. sbe.enable.precedence.checks=true and the SBE_ENABLE_PRECEDENCE_CHECKS macro disabled - quite a pointless version with zero checks but some overhead caused by adding more variables.

I can see two ways to solve this situation - either drop the SBE_ENABLE_PRECEDENCE_CHECKS macro and with the sbe.enable.precedence.checks=true flag generate code that always does precedence checks (should simplify the generated code) or polish the generated code not to have any overhead with the SBE_ENABLE_PRECEDENCE_CHECKS macro enabled. The second approach seems more complicated but also much more consistent with what other language generators do.

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