使用boostspiritx3编译时间

您所在的位置:网站首页 python中alnum 使用boostspiritx3编译时间

使用boostspiritx3编译时间

2023-03-15 15:40| 来源: 网络整理| 查看: 265

storage = { "foo()", "-foo()", "f1_2()", "foo_bar ()", "foo( bar (42, baz()))", "foo(5)", "foo(-5)", "foo(1.1, foo(4.21e-2, 4., 6))", "1.1", "-1.1", "1 * 1", "foo(1 * 1) * bar(42)", "foo(2 + 5.5, bar()*3.4-7)", "foo(2 + 5.5, bar(baz(-5/foo())) * 3.4 - 7)", "4 + 5 * 6", "1+2+3+4*5*6*-7+-8*+9-0", "(foo())", "foo() * ((1+2)+3*(2+3))", "(1+2)*3", "1+2*3", "foo" }; using boost::spirit::x3::ascii::space; for (const auto &item : storage) { using client::parser::expr; // Our grammar client::ast::expr_ast ast; // Our tree std::string::const_iterator iter = item.begin(); std::string::const_iterator end = item.end(); bool r = phrase_parse(iter, end, expr, space, ast); if (r && iter == end) { std::cout

sehe.. 5

这看起来像是对我的严重倒退.

我的机器花了很长时间:

gcc 5:在4分30秒后慢慢使用越来越多的内存到3GiB,然后是〜20s的汇编程序阶段:

g++-5 -std=c++14 -Wall -pedantic -Wextra -fsanitize=undefined,address -Wno-unused -g -O3 -isystem /home/sehe/custom/nonius/include -isystem /home/sehe/custom/boost_1_60_0 -pthread -march=native test.cpp -c -o test.o test.cpp:119:62: warning: extra ‘;’ [-Wpedantic] BOOST_SPIRIT_DEFINE(expr, add_expr, mult_expr, block_expr); ^ g++-5 -std=c++14 -Wall -pedantic -Wextra -fsanitize=undefined,address -Wno-unused -g -O3 -isystem /home/sehe/custom/nonius/include -isystem /home/sehe/custom/boost_1_60_0 -pthread -march=native test.o -o test -L /home/sehe/custom/boost_1_60_0/stage/lib/ -Wl,-rpath,/home/sehe/custom/boost_1_60_0/stage/lib -lboost_system -lboost_regex -lboost_thread -lboost_iostreams -lboost_serialization -lboost_filesystem -lboost_chrono -lrt -lboost_unit_test_framework -lpugixml -lssl -lcrypto -lxml2 real 4m50.427s user 4m48.248s sys 0m1.856s

clang 3.6:超出模板实例化深度失败

/home/sehe/custom/boost_1_60_0/boost/spirit/home/x3/support/context.hpp|30 col 25| fatal error: recursive template instantiation exceeded maximum depth of 256

然后,这直接暗示了导致它的原因.

我的第一个预感是,x3::variant可能会导致编译器更积极地内联,但替换为boost :: variant并没有多大帮助:

g++-5 -std=c++14 -Wall -pedantic -Wextra -fsanitize=undefined,address -Wno-unused -g -O3 -isystem /home/sehe/custom/nonius/include -isystem /home/sehe/custom/boost_1_60_0 -pthread -march=native test.cpp -c -o test.o test.cpp:135:62: warning: extra ‘;’ [-Wpedantic] BOOST_SPIRIT_DEFINE(expr, add_expr, mult_expr, block_expr); ^ g++-5 -std=c++14 -Wall -pedantic -Wextra -fsanitize=undefined,address -Wno-unused -g -O3 -isystem /home/sehe/custom/nonius/include -isystem /home/sehe/custom/boost_1_60_0 -pthread -march=native test.o -o test -L /home/sehe/custom/boost_1_60_0/stage/lib/ -Wl,-rpath,/home/sehe/custom/boost_1_60_0/stage/lib -lboost_system -lboost_regex -lboost_thread -lboost_iostreams -lboost_serialization -lboost_filesystem -lboost_chrono -lrt -lboost_unit_test_framework -lpugixml -lssl -lcrypto -lxml2 real 3m55.728s

在resuts没有区别:

Ok: foo() result: foo() Fail: -foo() Ok: f1_2() result: f1_2() Ok: foo_bar () result: foo_bar() Ok: foo( bar (42, baz())) result: foo(bar(42,baz())) Ok: foo(5) result: foo(5) Ok: foo(-5) result: foo(-5) Ok: foo(1.1, foo(4.21e-2, 4., 6)) result: foo(1.100000,foo(0.042100,4.000000,6)) Ok: 1.1 result: 1.100000 Ok: -1.1 result: -1.100000 Ok: 1 * 1 result: (1 * 1) Ok: foo(1 * 1) * bar(42) result: (foo((1 * 1)) * bar(42)) Ok: foo(2 + 5.5, bar()*3.4-7) result: foo((2 + 5.500000),((bar() * 3.400000) - 7)) Ok: foo(2 + 5.5, bar(baz(-5/foo())) * 3.4 - 7) result: foo((2 + 5.500000),((bar(baz((-5 / foo()))) * 3.400000) - 7)) Ok: 4 + 5 * 6 result: (4 + (5 * 6)) Ok: 1+2+3+4*5*6*-7+-8*+9-0 result: (1 + (2 + (3 + ((4 * (5 * (6 * -7))) + ((-8 * 9) - 0))))) Ok: (foo()) result: foo() Ok: foo() * ((1+2)+3*(2+3)) result: (foo() * ((1 + 2) + (3 * (2 + 3)))) Ok: (1+2)*3 result: ((1 + 2) * 3) Ok: 1+2*3 result: (1 + (2 * 3)) Fail: foo

我会在Spirit邮件列表中报告这个:http://boost.2283326.n4.nabble.com/spirit-general-f2672582.html

1> sehe..:

这看起来像是对我的严重倒退.

我的机器花了很长时间:

gcc 5:在4分30秒后慢慢使用越来越多的内存到3GiB,然后是〜20s的汇编程序阶段:

g++-5 -std=c++14 -Wall -pedantic -Wextra -fsanitize=undefined,address -Wno-unused -g -O3 -isystem /home/sehe/custom/nonius/include -isystem /home/sehe/custom/boost_1_60_0 -pthread -march=native test.cpp -c -o test.o test.cpp:119:62: warning: extra ‘;’ [-Wpedantic] BOOST_SPIRIT_DEFINE(expr, add_expr, mult_expr, block_expr); ^ g++-5 -std=c++14 -Wall -pedantic -Wextra -fsanitize=undefined,address -Wno-unused -g -O3 -isystem /home/sehe/custom/nonius/include -isystem /home/sehe/custom/boost_1_60_0 -pthread -march=native test.o -o test -L /home/sehe/custom/boost_1_60_0/stage/lib/ -Wl,-rpath,/home/sehe/custom/boost_1_60_0/stage/lib -lboost_system -lboost_regex -lboost_thread -lboost_iostreams -lboost_serialization -lboost_filesystem -lboost_chrono -lrt -lboost_unit_test_framework -lpugixml -lssl -lcrypto -lxml2 real 4m50.427s user 4m48.248s sys 0m1.856s

clang 3.6:超出模板实例化深度失败

/home/sehe/custom/boost_1_60_0/boost/spirit/home/x3/support/context.hpp|30 col 25| fatal error: recursive template instantiation exceeded maximum depth of 256

然后,这直接暗示了导致它的原因.

我的第一个预感是,x3::variant可能会导致编译器更积极地内联,但替换为boost :: variant并没有多大帮助:

g++-5 -std=c++14 -Wall -pedantic -Wextra -fsanitize=undefined,address -Wno-unused -g -O3 -isystem /home/sehe/custom/nonius/include -isystem /home/sehe/custom/boost_1_60_0 -pthread -march=native test.cpp -c -o test.o test.cpp:135:62: warning: extra ‘;’ [-Wpedantic] BOOST_SPIRIT_DEFINE(expr, add_expr, mult_expr, block_expr); ^ g++-5 -std=c++14 -Wall -pedantic -Wextra -fsanitize=undefined,address -Wno-unused -g -O3 -isystem /home/sehe/custom/nonius/include -isystem /home/sehe/custom/boost_1_60_0 -pthread -march=native test.o -o test -L /home/sehe/custom/boost_1_60_0/stage/lib/ -Wl,-rpath,/home/sehe/custom/boost_1_60_0/stage/lib -lboost_system -lboost_regex -lboost_thread -lboost_iostreams -lboost_serialization -lboost_filesystem -lboost_chrono -lrt -lboost_unit_test_framework -lpugixml -lssl -lcrypto -lxml2 real 3m55.728s

在resuts没有区别:

Ok: foo() result: foo() Fail: -foo() Ok: f1_2() result: f1_2() Ok: foo_bar () result: foo_bar() Ok: foo( bar (42, baz())) result: foo(bar(42,baz())) Ok: foo(5) result: foo(5) Ok: foo(-5) result: foo(-5) Ok: foo(1.1, foo(4.21e-2, 4., 6)) result: foo(1.100000,foo(0.042100,4.000000,6)) Ok: 1.1 result: 1.100000 Ok: -1.1 result: -1.100000 Ok: 1 * 1 result: (1 * 1) Ok: foo(1 * 1) * bar(42) result: (foo((1 * 1)) * bar(42)) Ok: foo(2 + 5.5, bar()*3.4-7) result: foo((2 + 5.500000),((bar() * 3.400000) - 7)) Ok: foo(2 + 5.5, bar(baz(-5/foo())) * 3.4 - 7) result: foo((2 + 5.500000),((bar(baz((-5 / foo()))) * 3.400000) - 7)) Ok: 4 + 5 * 6 result: (4 + (5 * 6)) Ok: 1+2+3+4*5*6*-7+-8*+9-0 result: (1 + (2 + (3 + ((4 * (5 * (6 * -7))) + ((-8 * 9) - 0))))) Ok: (foo()) result: foo() Ok: foo() * ((1+2)+3*(2+3)) result: (foo() * ((1 + 2) + (3 * (2 + 3)))) Ok: (1+2)*3 result: ((1 + 2) * 3) Ok: 1+2*3 result: (1 + (2 * 3)) Fail: foo

我会在Spirit邮件列表中报告这个:http://boost.2283326.n4.nabble.com/spirit-general-f2672582.html



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3