mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-22 09:30:32 +00:00
Tidy the previous cycle parsing refactor and reset to a simdjson pukka run.
Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
This commit is contained in:
parent
79f3e3ac6c
commit
fa50f74508
@ -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
|
||||
|
@ -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; }
|
||||
|
@ -11,12 +11,12 @@
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user