-
Notifications
You must be signed in to change notification settings - Fork 261
[BUG] perf: having many expressions is slow to lex #513
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
Labels
bug
Something isn't working
Comments
For the following table:
|
For the following table:
Legend:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Title: perf: having many expressions is slow to lex.
Description:
On my system,
the following test takes the longest time
to run through Cppfront and
to build with the Cpp1 compiler.
For the following table:
mixed-as-for-variant-20-types
On Debug mode,
the time to lower
mixed-as-for-variant-20-types
is very close to that of building the lowered Cpp1 (which is heavy on template instantiations).
Minimal reproducer (https://cpp2.godbolt.org/z/EvqKM4jMe):
[ Note:
During the lex phase,
(x)$(x)$
becomescpp2::to_string(x) + cpp2::to_string(x)
.-- end note ]
Commands:
cppfront main.cpp2 clang++17 -std=c++23 -stdlib=libc++ -lc++abi -pedantic-errors -Wall -Wextra -Wconversion -I . main.cpp
Expected result:
Enough performance that lowering Cpp2 doesn't rival template-heavy Cpp1.
Actual result and error:
For the following table:
The fault seems to lie in the use of
std::regex
.In the following flame graph,
highlighted in blue is the compilation of a constant "is a keyword?" regex recompiled every iteration,
and then their neighboring
std::regex_search
which still seems to amount to ~½ of the total time.The text was updated successfully, but these errors were encountered: