Skip to content

Commit 2e3388a

Browse files
committed
benchmarks for direct conversions
So far supports: * apache_builds.json * canada.json * citm_catalog.json
1 parent 159a8f3 commit 2e3388a

File tree

9 files changed

+524
-148
lines changed

9 files changed

+524
-148
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ if(BOOST_JSON_IS_ROOT)
4545

4646
set(BOOST_INCLUDE_LIBRARIES json)
4747
set(BOOST_EXCLUDE_LIBRARIES json)
48+
if(BOOST_JSON_BUILD_EXAMPLES)
49+
list(APPEND BOOST_INCLUDE_LIBRARIES optional)
50+
endif()
4851

4952
set(CMAKE_FOLDER _deps)
5053
add_subdirectory(../.. _deps/boost EXCLUDE_FROM_ALL)

bench/Jamfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ exe bench :
3535
/boost/json//boost_json
3636
:
3737
<include>../test
38+
<include>../example
3839
$(has_nlohmann_json)<define>BOOST_JSON_HAS_NLOHMANN_JSON
3940
$(has_rapidjson)<define>BOOST_JSON_HAS_RAPIDJSON
4041
;

bench/apache_builds.hpp

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
//
2+
// Copyright (c) 2024 Dmitry Arkhipov ([email protected])
3+
//
4+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
5+
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6+
//
7+
// Official repository: https://github.com/boostorg/json
8+
//
9+
10+
#ifndef BOOST_JSON_BENCH_APACHE_BUILDS_HPP
11+
#define BOOST_JSON_BENCH_APACHE_BUILDS_HPP
12+
13+
#include <boost/describe/class.hpp>
14+
#include <boost/optional/optional.hpp>
15+
#include <map>
16+
#include <string>
17+
#include <vector>
18+
19+
namespace boost {
20+
namespace json {
21+
namespace apache_builds {
22+
23+
struct label
24+
{
25+
boost::optional<std::string> name;
26+
};
27+
BOOST_DESCRIBE_STRUCT( label, (), (name) )
28+
29+
struct job
30+
{
31+
std::string name;
32+
std::string url;
33+
std::string color;
34+
};
35+
BOOST_DESCRIBE_STRUCT( job, (), (name, url, color) )
36+
37+
struct view
38+
{
39+
std::string name;
40+
std::string url;
41+
};
42+
BOOST_DESCRIBE_STRUCT( view, (), (name, url) )
43+
44+
struct builds
45+
{
46+
std::vector<label> assignedLabels;
47+
std::string mode;
48+
std::string nodeDescription;
49+
std::string nodeName;
50+
std::size_t numExecutors;
51+
std::string description;
52+
std::vector<job> jobs;
53+
std::map<std::string, int> overallLoad;
54+
view primaryView;
55+
bool quietingDown;
56+
std::size_t slaveAgentPort;
57+
std::map<std::string, int> unlabeledLoad;
58+
bool useCrumbs;
59+
bool useSecurity;
60+
std::vector<view> views;
61+
};
62+
BOOST_DESCRIBE_STRUCT(
63+
builds,
64+
(),
65+
( assignedLabels,
66+
mode,
67+
nodeDescription,
68+
nodeName,
69+
numExecutors,
70+
description,
71+
jobs,
72+
overallLoad,
73+
primaryView,
74+
quietingDown,
75+
slaveAgentPort,
76+
unlabeledLoad,
77+
useCrumbs,
78+
useSecurity,
79+
views )
80+
)
81+
82+
} // namespace apache_builds
83+
84+
struct apache_builds_support
85+
{
86+
using type = apache_builds::builds;
87+
static constexpr char const* const name = "apache_builds.json";
88+
};
89+
90+
} // namespace json
91+
} // namespace boost
92+
93+
#endif // BOOST_JSON_BENCH_APACHE_BUILDS_HPP

0 commit comments

Comments
 (0)