Use simdjson::builtin instead of haswell/begin+end

This commit is contained in:
John Keiser 2020-09-09 06:48:51 -07:00
parent 85cefd5a00
commit 30fe86ed32
11 changed files with 18 additions and 51 deletions

View File

@ -7,10 +7,6 @@ SIMDJSON_PUSH_DISABLE_ALL_WARNINGS
#include <benchmark/benchmark.h>
SIMDJSON_POP_DISABLE_WARNINGS
#if SIMDJSON_IMPLEMENTATION_HASWELL
#include "simdjson/haswell/begin.h"
#endif // SIMDJSON_IMPLEMENTATION_HASWELL
#include "partial_tweets/ondemand.h"
#include "partial_tweets/iter.h"
#include "partial_tweets/dom.h"
@ -24,7 +20,3 @@ SIMDJSON_POP_DISABLE_WARNINGS
#include "kostya/dom.h"
BENCHMARK_MAIN();
#if SIMDJSON_IMPLEMENTATION_HASWELL
#include "simdjson/haswell/end.h"
#endif // SIMDJSON_IMPLEMENTATION_HASWELL

View File

@ -8,16 +8,7 @@ SIMDJSON_PUSH_DISABLE_ALL_WARNINGS
#include <benchmark/benchmark.h>
SIMDJSON_POP_DISABLE_WARNINGS
#if SIMDJSON_IMPLEMENTATION_HASWELL
#include "simdjson/haswell/begin.h"
#endif // SIMDJSON_IMPLEMENTATION_HASWELL
#include "partial_tweets/sax.h"
#include "largerandom/sax.h"
BENCHMARK_MAIN();
#if SIMDJSON_IMPLEMENTATION_HASWELL
#include "simdjson/haswell/end.h"
#endif // SIMDJSON_IMPLEMENTATION_HASWELL

View File

@ -1,6 +1,5 @@
#pragma once
#ifdef SIMDJSON_IMPLEMENTATION
#if SIMDJSON_EXCEPTIONS
#include "kostya.h"
@ -8,7 +7,7 @@
namespace kostya {
using namespace simdjson;
using namespace simdjson::SIMDJSON_IMPLEMENTATION;
using namespace simdjson::builtin;
class Iter {
public:
@ -21,12 +20,12 @@ private:
ondemand::parser parser{};
std::vector<my_point> container{};
simdjson_really_inline simdjson_result<double> first_double(SIMDJSON_IMPLEMENTATION::ondemand::json_iterator &iter, const char *key) {
simdjson_really_inline simdjson_result<double> first_double(ondemand::json_iterator &iter, const char *key) {
if (!iter.start_object() || ondemand::raw_json_string(iter.field_key()) != key || iter.field_value()) { throw "Invalid field"; }
return iter.get_double();
}
simdjson_really_inline simdjson_result<double> next_double(SIMDJSON_IMPLEMENTATION::ondemand::json_iterator &iter, const char *key) {
simdjson_really_inline simdjson_result<double> next_double(ondemand::json_iterator &iter, const char *key) {
if (!iter.has_next_field() || ondemand::raw_json_string(iter.field_key()) != key || iter.field_value()) { throw "Invalid field"; }
return iter.get_double();
}
@ -95,4 +94,3 @@ BENCHMARK_TEMPLATE(KostyaSum, Iter);
} // namespace kostya
#endif // SIMDJSON_EXCEPTIONS
#endif // SIMDJSON_IMPLEMENTATION

View File

@ -1,6 +1,5 @@
#pragma once
#ifdef SIMDJSON_IMPLEMENTATION
#if SIMDJSON_EXCEPTIONS
#include "kostya.h"
@ -8,7 +7,7 @@
namespace kostya {
using namespace simdjson;
using namespace simdjson::SIMDJSON_IMPLEMENTATION;
using namespace simdjson::builtin;
class OnDemand {
public:
@ -75,4 +74,3 @@ BENCHMARK_TEMPLATE(KostyaSum, OnDemand);
} // namespace kostya
#endif // SIMDJSON_EXCEPTIONS
#endif // SIMDJSON_IMPLEMENTATION

View File

@ -1,6 +1,5 @@
#pragma once
#ifdef SIMDJSON_IMPLEMENTATION
#if SIMDJSON_EXCEPTIONS
#include "largerandom.h"
@ -8,7 +7,7 @@
namespace largerandom {
using namespace simdjson;
using namespace simdjson::SIMDJSON_IMPLEMENTATION;
using namespace simdjson::builtin;
class Iter {
public:
@ -21,12 +20,12 @@ private:
ondemand::parser parser{};
std::vector<my_point> container{};
simdjson_really_inline double first_double(SIMDJSON_IMPLEMENTATION::ondemand::json_iterator &iter) {
simdjson_really_inline double first_double(ondemand::json_iterator &iter) {
if (iter.start_object().error() || iter.field_key().error() || iter.field_value()) { throw "Invalid field"; }
return iter.get_double();
}
simdjson_really_inline double next_double(SIMDJSON_IMPLEMENTATION::ondemand::json_iterator &iter) {
simdjson_really_inline double next_double(ondemand::json_iterator &iter) {
if (!iter.has_next_field() || iter.field_key().error() || iter.field_value()) { throw "Invalid field"; }
return iter.get_double();
}
@ -91,4 +90,3 @@ BENCHMARK_TEMPLATE(LargeRandomSum, Iter);
} // namespace largerandom
#endif // SIMDJSON_EXCEPTIONS
#endif // SIMDJSON_IMPLEMENTATION

View File

@ -1,6 +1,5 @@
#pragma once
#ifdef SIMDJSON_IMPLEMENTATION
#if SIMDJSON_EXCEPTIONS
#include "largerandom.h"
@ -8,7 +7,7 @@
namespace largerandom {
using namespace simdjson;
using namespace simdjson::SIMDJSON_IMPLEMENTATION;
using namespace simdjson::builtin;
class OnDemand {
public:
@ -72,4 +71,3 @@ BENCHMARK_TEMPLATE(LargeRandomSum, OnDemand);
} // namespace largerandom
#endif // SIMDJSON_EXCEPTIONS
#endif // SIMDJSON_IMPLEMENTATION

View File

@ -1,6 +1,5 @@
#pragma once
#ifdef SIMDJSON_IMPLEMENTATION
#if SIMDJSON_EXCEPTIONS
#include "largerandom.h"
@ -8,8 +7,8 @@
namespace largerandom {
using namespace simdjson;
using namespace SIMDJSON_IMPLEMENTATION;
using namespace SIMDJSON_IMPLEMENTATION::stage2;
using namespace simdjson::builtin;
using namespace simdjson::builtin::stage2;
class Sax {
public:
@ -28,8 +27,8 @@ private:
};
using namespace simdjson;
using namespace SIMDJSON_IMPLEMENTATION;
using namespace SIMDJSON_IMPLEMENTATION::stage2;
using namespace simdjson::builtin;
using namespace simdjson::builtin::stage2;
struct sax_point_reader_visitor {
public:
std::vector<my_point> &points;
@ -123,4 +122,3 @@ BENCHMARK_TEMPLATE(LargeRandom, Sax);
} // namespace largerandom
#endif // SIMDJSON_EXCEPTIONS
#endif // SIMDJSON_IMPLEMENTATION

View File

@ -1,6 +1,5 @@
#pragma once
#ifdef SIMDJSON_IMPLEMENTATION
#if SIMDJSON_EXCEPTIONS
#include "partial_tweets.h"
@ -8,7 +7,7 @@
namespace partial_tweets {
using namespace simdjson;
using namespace simdjson::SIMDJSON_IMPLEMENTATION;
using namespace simdjson::builtin;
class Iter {
public:
@ -92,4 +91,3 @@ BENCHMARK_TEMPLATE(PartialTweets, Iter);
} // namespace partial_tweets
#endif // SIMDJSON_EXCEPTIONS
#endif // SIMDJSON_IMPLEMENTATION

View File

@ -1,6 +1,5 @@
#pragma once
#ifdef SIMDJSON_IMPLEMENTATION
#if SIMDJSON_EXCEPTIONS
#include "partial_tweets.h"
@ -8,7 +7,7 @@
namespace partial_tweets {
using namespace simdjson;
using namespace simdjson::SIMDJSON_IMPLEMENTATION;
using namespace simdjson::builtin;
class OnDemand {
public:
@ -57,4 +56,3 @@ BENCHMARK_TEMPLATE(PartialTweets, OnDemand);
} // namespace partial_tweets
#endif // SIMDJSON_EXCEPTIONS
#endif // SIMDJSON_IMPLEMENTATION

View File

@ -1,6 +1,5 @@
#pragma once
#ifdef SIMDJSON_IMPLEMENTATION
#include "partial_tweets.h"
#include "sax_tweet_reader_visitor.h"
@ -8,8 +7,8 @@
namespace partial_tweets {
using namespace simdjson;
using namespace SIMDJSON_IMPLEMENTATION;
using namespace SIMDJSON_IMPLEMENTATION::stage2;
using namespace simdjson::builtin;
using namespace simdjson::builtin::stage2;
class Sax {
public:
@ -68,4 +67,3 @@ BENCHMARK_TEMPLATE(PartialTweets, Sax);
} // namespace partial_tweets
#endif // SIMDJSON_IMPLEMENTATION

View File

@ -7,8 +7,8 @@
namespace partial_tweets {
using namespace simdjson;
using namespace SIMDJSON_IMPLEMENTATION;
using namespace SIMDJSON_IMPLEMENTATION::stage2;
using namespace simdjson::builtin;
using namespace simdjson::builtin::stage2;
struct sax_tweet_reader_visitor {
public: