Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
biojppm committed Apr 1, 2024
1 parent 61bb935 commit 71dd67f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 50 deletions.
28 changes: 14 additions & 14 deletions bm/bm_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ void bm_ryml_json_arena_reserve(bm::State& st)
ryml::id_type cap = estimate_capacity(src);
for(auto _ : st)
{
st.PauseTiming();
ONLY_FOR_JSON;
st.PauseTiming();
ryml::Tree tree;
tree.reserve(cap);
st.ResumeTiming();
Expand All @@ -250,8 +250,8 @@ void bm_ryml_json_arena_nofilter(bm::State& st)
c4::csubstr src = c4::to_csubstr(s_bm_case->src).trimr('\0');
for(auto _ : st)
{
st.PauseTiming();
ONLY_FOR_JSON;
st.PauseTiming();
ryml::EventHandlerTree evth;
ryml::Parser parser(&evth, ryml::ParserOptions().scalar_filtering(false));
st.ResumeTiming();
Expand All @@ -266,8 +266,8 @@ void bm_ryml_json_arena_nofilter_reserve(bm::State& st)
ryml::id_type cap = estimate_capacity(src);
for(auto _ : st)
{
st.PauseTiming();
ONLY_FOR_JSON;
st.PauseTiming();
ryml::EventHandlerTree evth;
ryml::Parser parser(&evth, ryml::ParserOptions().scalar_filtering(false));
ryml::Tree tree;
Expand Down Expand Up @@ -299,7 +299,7 @@ void bm_ryml_yaml_inplace_reserve(bm::State& st)
for(auto _ : st)
{
st.PauseTiming();
s_bm_case->prepare(st, kResetInPlace);
s_bm_case->prepare(kResetInPlace);
ryml::Tree tree;
tree.reserve(cap);
st.ResumeTiming();
Expand All @@ -314,7 +314,7 @@ void bm_ryml_yaml_inplace_nofilter(bm::State& st)
for(auto _ : st)
{
st.PauseTiming();
s_bm_case->prepare(st, kResetInPlace);
s_bm_case->prepare(kResetInPlace);
ryml::EventHandlerTree evth;
ryml::Parser parser(&evth, ryml::ParserOptions().scalar_filtering(false));
st.ResumeTiming();
Expand All @@ -330,7 +330,7 @@ void bm_ryml_yaml_inplace_nofilter_reserve(bm::State& st)
for(auto _ : st)
{
st.PauseTiming();
s_bm_case->prepare(st, kResetInPlace);
s_bm_case->prepare(kResetInPlace);
ryml::EventHandlerTree evth;
ryml::Parser parser(&evth, ryml::ParserOptions().scalar_filtering(false));
ryml::Tree tree;
Expand All @@ -349,9 +349,9 @@ void bm_ryml_json_inplace(bm::State& st)
c4::substr src = c4::to_substr(s_bm_case->in_place).trimr('\0');
for(auto _ : st)
{
st.PauseTiming();
ONLY_FOR_JSON;
s_bm_case->prepare(st, kResetInPlace);
st.PauseTiming();
s_bm_case->prepare(kResetInPlace);
st.ResumeTiming();
ryml::Tree tree = ryml::parse_json_in_place(s_bm_case->filename, src);
}
Expand All @@ -364,9 +364,9 @@ void bm_ryml_json_inplace_reserve(bm::State& st)
ryml::id_type cap = estimate_capacity(src);
for(auto _ : st)
{
st.PauseTiming();
ONLY_FOR_JSON;
s_bm_case->prepare(st, kResetInPlace);
st.PauseTiming();
s_bm_case->prepare(kResetInPlace);
ryml::Tree tree;
tree.reserve(cap);
st.ResumeTiming();
Expand All @@ -380,9 +380,9 @@ void bm_ryml_json_inplace_nofilter(bm::State& st)
c4::substr src = c4::to_substr(s_bm_case->in_place).trimr('\0');
for(auto _ : st)
{
st.PauseTiming();
ONLY_FOR_JSON;
s_bm_case->prepare(st, kResetInPlace);
st.PauseTiming();
s_bm_case->prepare(kResetInPlace);
ryml::EventHandlerTree evth;
ryml::Parser parser(&evth, ryml::ParserOptions().scalar_filtering(false));
st.ResumeTiming();
Expand All @@ -397,9 +397,9 @@ void bm_ryml_json_inplace_nofilter_reserve(bm::State& st)
ryml::id_type cap = estimate_capacity(src);
for(auto _ : st)
{
st.PauseTiming();
ONLY_FOR_JSON;
s_bm_case->prepare(st, kResetInPlace);
st.PauseTiming();
s_bm_case->prepare(kResetInPlace);
ryml::EventHandlerTree evth;
ryml::Parser parser(&evth, ryml::ParserOptions().scalar_filtering(false));
ryml::Tree tree;
Expand Down
26 changes: 15 additions & 11 deletions src/c4/yml/detail/parser_dbg.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,20 @@
#else
# define _c4err(fmt, ...) \
do { RYML_DEBUG_BREAK(); this->_err("ERROR:\n" "{}:{}: " fmt, __FILE__, __LINE__, ## __VA_ARGS__); } while(0)
# define _c4dbgt(fmt, ...) this->_dbg ("{}:{}: " fmt , __FILE__, __LINE__, ## __VA_ARGS__)
# define _c4dbgpf(fmt, ...) _dbg_printf("{}:{}: " fmt "\n", __FILE__, __LINE__, ## __VA_ARGS__)
# define _c4dbgpf_(fmt, ...) _dbg_printf("{}:{}: " fmt , __FILE__, __LINE__, ## __VA_ARGS__)
# define _c4dbgp(msg) _dbg_printf("{}:{}: " msg "\n", __FILE__, __LINE__ )
# define _c4dbgp_(msg) _dbg_printf("{}:{}: " msg , __FILE__, __LINE__ )
# define _c4dbgq(msg) _dbg_printf(msg "\n")
# define _c4dbgt(fmt, ...) do { if(_dbg_enabled()) { this->_dbg ("{}:{}: " fmt , __FILE__, __LINE__, ## __VA_ARGS__); } } while(0)
# define _c4dbgpf(fmt, ...) do { if(_dbg_enabled()) { _dbg_printf("{}:{}: " fmt "\n", __FILE__, __LINE__, ## __VA_ARGS__); } } while(0)
# define _c4dbgpf_(fmt, ...) do { if(_dbg_enabled()) { _dbg_printf("{}:{}: " fmt , __FILE__, __LINE__, ## __VA_ARGS__); } } while(0)
# define _c4dbgp(msg) do { if(_dbg_enabled()) { _dbg_printf("{}:{}: " msg "\n", __FILE__, __LINE__ ); } } while(0)
# define _c4dbgp_(msg) do { if(_dbg_enabled()) { _dbg_printf("{}:{}: " msg , __FILE__, __LINE__ ); } } while(0)
# define _c4dbgq(msg) do { if(_dbg_enabled()) { _dbg_printf(msg "\n"); } } while(0)
# define _c4presc(...) __c4presc(__VA_ARGS__)
# define _c4prscalar(msg, scalar, keep_newlines) \
do { \
_c4dbgpf_("{}: [{}]~~~", msg, scalar.len); \
__c4presc((scalar).str, (scalar).len, (keep_newlines)); \
_c4dbgq("~~~"); \
# define _c4prscalar(msg, scalar, keep_newlines) \
do { \
_c4dbgpf_("{}: [{}]~~~", msg, scalar.len); \
if(_dbg_enabled()) { \
__c4presc((scalar).str, (scalar).len, (keep_newlines)); \
} \
_c4dbgq("~~~"); \
} while(0)
#endif // RYML_DBG

Expand All @@ -64,6 +66,8 @@

#include <c4/dump.hpp>
namespace c4 {
inline bool& _dbg_enabled() { static bool enabled = true; return enabled; }
inline void _set_dbg_enabled(bool yes) { _dbg_enabled() = yes; }
inline void _dbg_dumper(csubstr s)
{
if(s.str)
Expand Down
30 changes: 5 additions & 25 deletions test/test_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1468,39 +1468,19 @@ image: Visual Studio 2017
environment:
matrix:
- compiler: msvc-15-seh
generator: "Visual Studio 15 2017"
configuration: Debug
- compiler: msvc-15-seh
generator: "Visual Studio 15 2017 Win64"
configuration: Debug
- compiler: msvc-15-seh
generator: "Visual Studio 15 2017 Win64"
configuration: Debug
- compiler: msvc-15-seh
)",
N(MB, L{
N(KP|VS, "version", "{build}"),
N(KP|VP, "image", "Visual Studio 2017"),
N(KP|MB, "environment", L{
N(KP|SB, "matrix", L{
N(MB, L{
N(KP|VP, "compiler", "msvc-15-seh"),
N(KP|VD, "generator", "Visual Studio 15 2017"),
N(KP|VP, "configuration", "Debug"),
}),
N(MB, L{
N(KP|VP, "compiler", "msvc-15-seh"),
N(KP|VD, "generator", "Visual Studio 15 2017 Win64"),
N(KP|VP, "configuration", "Debug"),
}),
N(MB, L{
N(KP|VP, "compiler", "msvc-15-seh"),
N(KP|VD, "generator", "Visual Studio 15 2017 Win64"),
N(KP|VP, "configuration", "Debug"),
}),
N(MB, L{N(KP|VP, "compiler", "msvc-15-seh"),}),
N(MB, L{N(KP|VP, "compiler", "msvc-15-seh"),}),
N(MB, L{N(KP|VP, "compiler", "msvc-15-seh"),}),
})
})
})
Expand All @@ -1520,7 +1500,7 @@ R"(matrix:
- env: CXX_=g++-7 A=32 BT=Debug SAN=ALL VG=ON
)",
N(MB, L{
N(KP|SB, "matrix", L{
N(KP|MB, "matrix", L{
N(KP|SB, "include", L{
N(MB, L{N(KP|VP, "env", "CXX_=g++-7 A=64 BT=Coverage"),}),
N(MB, L{N(KP|VP, "env", "CXX_=g++-7 A=32 BT=Coverage"),}),
Expand Down

0 comments on commit 71dd67f

Please sign in to comment.