From fa50f745085d3830c9197e88b9ae2b76bf58279c Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Mon, 18 Oct 2021 12:07:24 +0100 Subject: [PATCH] Tidy the previous cycle parsing refactor and reset to a simdjson pukka run. Signed-off-by: Adrian Conlon --- M6502/HarteTest_6502/cycle_t.cpp | 16 +++------------- M6502/HarteTest_6502/cycle_t.h | 1 - M6502/HarteTest_6502/stdafx.h | 6 +++--- M6502/HarteTest_6502/test_t.cpp | 26 ++++---------------------- M6502/HarteTest_6502/test_t.h | 4 ---- 5 files changed, 10 insertions(+), 43 deletions(-) diff --git a/M6502/HarteTest_6502/cycle_t.cpp b/M6502/HarteTest_6502/cycle_t.cpp index 60f38a8..de83855 100644 --- a/M6502/HarteTest_6502/cycle_t.cpp +++ b/M6502/HarteTest_6502/cycle_t.cpp @@ -70,22 +70,12 @@ cycle_t::cycle_t(const nlohmann::json& input) #endif #ifdef USE_JSONCPP_JSON -//cycle_t(const Json::Value& input); cycle_t::cycle_t(const Json::Value& input) - : m_address(input[0].asUInt()), - m_value(input[1].asUInt()), - m_action(to_action(input[2].asString())) { +: m_address(input[0].asUInt()), + m_value(input[1].asUInt()), + m_action(to_action(input[2].asString())) { assert(input.size() == 3); } - -//for (const auto& cycles_entry : cycles_array) { -// assert(cycles_entry.size() == 3); -// const auto address = cycles_entry[0].asUInt(); -// const auto contents = cycles_entry[1].asUInt(); -// const auto action = to_action(cycles_entry[2].asString()); -// m_cycles.push_back({ address, contents, action }); -//} - #endif diff --git a/M6502/HarteTest_6502/cycle_t.h b/M6502/HarteTest_6502/cycle_t.h index 083fd18..968e9b1 100644 --- a/M6502/HarteTest_6502/cycle_t.h +++ b/M6502/HarteTest_6502/cycle_t.h @@ -54,7 +54,6 @@ public: cycle_t(const Json::Value& input); #endif - [[nodiscard]] constexpr auto address() const noexcept { return m_address; } [[nodiscard]] constexpr auto value() const noexcept { return m_value; } [[nodiscard]] constexpr auto action() const noexcept { return m_action; } diff --git a/M6502/HarteTest_6502/stdafx.h b/M6502/HarteTest_6502/stdafx.h index 2eb6336..fd42132 100644 --- a/M6502/HarteTest_6502/stdafx.h +++ b/M6502/HarteTest_6502/stdafx.h @@ -11,12 +11,12 @@ #include #include -#define TEST_JSON_PERFORMANCE +//#define TEST_JSON_PERFORMANCE -//#define USE_SIMDJSON_JSON // 14 seconds +#define USE_SIMDJSON_JSON // 14 seconds //#define USE_BOOST_JSON // 28 seconds //#define USE_NLOHMANN_JSON // 56 seconds -#define USE_JSONCPP_JSON // 105 seconds +//#define USE_JSONCPP_JSON // 97 seconds #ifdef USE_SIMDJSON_JSON # define JSON_PREFER_PASS_BY_VALUE diff --git a/M6502/HarteTest_6502/test_t.cpp b/M6502/HarteTest_6502/test_t.cpp index c6c030b..e06c234 100644 --- a/M6502/HarteTest_6502/test_t.cpp +++ b/M6502/HarteTest_6502/test_t.cpp @@ -38,27 +38,9 @@ test_t::test_t(const nlohmann::json& serialised) #ifdef USE_JSONCPP_JSON test_t::test_t(const Json::Value& serialised) - : m_name(serialised["name"].asString()), - m_initial_state(serialised["initial"]), - m_final_state(serialised["final"]), - m_cycles(serialised["cycles"]) {} - - - - //m_name = serialised["name"].asString(); - //m_initial_state = state_t(serialised["initial"]); - //m_final_state = state_t(serialised["final"]); - - //const auto& cycles_array = serialised["cycles"]; - //m_cycles.reserve(cycles_array.size()); - - //for (const auto& cycles_entry : cycles_array) { - // assert(cycles_entry.size() == 3); - // const auto address = cycles_entry[0].asUInt(); - // const auto contents = cycles_entry[1].asUInt(); - // const auto action = to_action(cycles_entry[2].asString()); - // m_cycles.push_back({ address, contents, action }); - //} -//} +: m_name(serialised["name"].asString()), + m_initial_state(serialised["initial"]), + m_final_state(serialised["final"]), + m_cycles(serialised["cycles"]) {} #endif diff --git a/M6502/HarteTest_6502/test_t.h b/M6502/HarteTest_6502/test_t.h index 05478de..798b46b 100644 --- a/M6502/HarteTest_6502/test_t.h +++ b/M6502/HarteTest_6502/test_t.h @@ -31,10 +31,6 @@ private: state_t m_final_state; cycles_t m_cycles; -//#ifdef USE_JSONCPP_JSON -// void initialise(const Json::Value& serialised); -//#endif - public: #ifdef USE_SIMDJSON_JSON