Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ if(CLP_NEED_NLOHMANN_JSON)
endif()

if(CLP_NEED_SIMDJSON)
find_package(simdjson REQUIRED)
find_package(simdjson 4.6.2 REQUIRED)
if(simdjson_FOUND)
message(STATUS "Found simdjson ${simdjson_VERSION}")
endif()
Expand Down
1 change: 1 addition & 0 deletions components/core/src/clp_s/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ if(CLP_BUILD_CLP_S_ARCHIVEREADER)
clp_s::timestamp_pattern
msgpack-cxx
nlohmann_json::nlohmann_json
simdjson::simdjson
ystdlib::error_handling
PRIVATE
Boost::url
Expand Down
12 changes: 12 additions & 0 deletions components/core/src/clp_s/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <boost/url.hpp>
#include <fmt/format.h>
#include <simdjson.h>
#include <spdlog/spdlog.h>
#include <string_utils/string_utils.hpp>

Expand Down Expand Up @@ -197,6 +198,17 @@ bool UriUtils::get_last_uri_component(std::string_view const uri, std::string& n
}

void StringUtils::escape_json_string(std::string& destination, std::string_view const source) {
simdjson::builtin::builder::string_builder json_string_builder{};
json_string_builder.clear();
json_string_builder.escape_and_append(source);
std::string_view escaped_source;
auto const status = json_string_builder.view().get(escaped_source);
if (simdjson::SUCCESS == status) {
destination.append(escaped_source);
return;
}

// Preserve the original implementation in case simdjson fails.
// Escaping is implemented using this `append_unescaped_slice` approach to offer a fast path
// when strings are mostly or entirely valid escaped JSON. Benchmarking shows that this offers
// a net decompression speedup of ~30% compared to adding every character to the destination one
Expand Down
2 changes: 1 addition & 1 deletion docs/src/dev-docs/components-core/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The task will download, build, and install (within the build directory) the foll
| [mongo-cxx-driver](https://github.com/mongodb/mongo-cxx-driver) | r4.1.1 |
| [msgpack-cxx](https://github.com/msgpack/msgpack-c/tree/cpp_master) | v7.0.0 |
| [nlohmann_json](https://github.com/nlohmann/json) | v3.11.3 |
| [simdjson](https://github.com/simdjson/simdjson) | v3.13.0 |
| [simdjson](https://github.com/simdjson/simdjson) | v4.6.2 |
| [spdlog](https://github.com/gabime/spdlog) | v1.15.3 |
| [SQLite3](https://www.sqlite.org/download.html) | v3.36.0 |
| [utfcpp](https://github.com/nemtrif/utfcpp) | v4.0.6 |
Expand Down
4 changes: 2 additions & 2 deletions taskfiles/deps/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ tasks:
- "-DCMAKE_BUILD_TYPE=Release"
- "-DCMAKE_INSTALL_MESSAGE=LAZY"
LIB_NAME: "simdjson"
TARBALL_SHA256: "07a1bb3587aac18fd6a10a83fe4ab09f1100ab39f0cb73baea1317826b9f9e0d"
TARBALL_URL: "https://github.com/simdjson/simdjson/archive/refs/tags/v3.13.0.tar.gz"
TARBALL_SHA256: "c240d4bffcccda4fe3a2bba2872718d96fc92e56d2615bfac4f9b2bad89a6386"
TARBALL_URL: "https://github.com/simdjson/simdjson/archive/refs/tags/v4.6.2.tar.gz"

spdlog:
internal: true
Expand Down
Loading