WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Performance in debug mode degraded by slow std::string::const_iterator constructor #298

@andreasbuhr

Description

@andreasbuhr

Unfortunately, boost.parser is very slow in debug mode.
Fortunately, this would be rather easy to change.

I have colleagues complaining because the Boost.Parser based parser takes forever in debug mode. I fired up VTune and quickly found that more than 60% of the total runtime is spent in the constructor and destructor of std::string::const_iterator. Boost.Parser is written under the assumption (it seems) that copying an iterator is basically free, which is probably true in release mode. But in MSVC/Debug it is a very expensive operation.

Looking at the code, I got the impression that in most places, nothing would be lost passing the iterators as const-ref instead of by-value. And the debug runtime would dramatically improve. Would you be open to change to const-ref for most iterator arguments? If so, I'd consider creating a Pull request doing this. Or am I missing a use case where the pass-by-value is beneficial?

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