-
Notifications
You must be signed in to change notification settings - Fork 610
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use simdjson for binary json construction for improved performance (#…
- Loading branch information
Showing
30 changed files
with
557 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ PEERDIR( | |
contrib/libs/apache/arrow | ||
ydb/library/conclusion | ||
ydb/core/scheme_types | ||
ydb/library/actors/core | ||
) | ||
|
||
END() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include <benchmark/benchmark.h> | ||
|
||
#include <util/random/random.h> | ||
#include <library/cpp/testing/unittest/registar.h> | ||
#include <library/cpp/json/json_value.h> | ||
#include <library/cpp/json/json_writer.h> | ||
|
||
#include <ydb/library/binary_json/write.h> | ||
|
||
// ya test -r -D BENCHMARK_MAKE_LARGE_PART | ||
#ifndef BENCHMARK_MAKE_LARGE_PART | ||
#define BENCHMARK_MAKE_LARGE_PART 0 | ||
#endif | ||
|
||
using namespace NKikimr::NBinaryJson; | ||
|
||
namespace { | ||
|
||
static ui64 seed = 0; | ||
|
||
NJson::TJsonValue GetTestJson(ui64 depth = 10, ui64 nChildren = 2) { | ||
NJson::TJsonValue value; | ||
if (depth == 1) { | ||
value.SetValue(NUnitTest::RandomString(10, seed++)); | ||
return value; | ||
} | ||
for (ui64 i = 0; i < nChildren; ++i) { | ||
value.InsertValue(NUnitTest::RandomString(10, seed++), GetTestJson(depth - 1)); | ||
} | ||
return value; | ||
} | ||
|
||
TString GetTestJsonString() { | ||
seed = 42; | ||
return NJson::WriteJson(GetTestJson(3, 50)); | ||
} | ||
|
||
static void BenchWriteSimdJson(benchmark::State& state) { | ||
TString value = GetTestJsonString(); | ||
TStringBuf buf(value); | ||
for (auto _ : state) { | ||
auto result = SerializeToBinaryJson(buf); | ||
benchmark::DoNotOptimize(result); | ||
benchmark::ClobberMemory(); | ||
} | ||
} | ||
|
||
} | ||
|
||
BENCHMARK(BenchWriteSimdJson)->MinTime(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
G_BENCHMARK() | ||
|
||
TAG(ya:fat) | ||
SIZE(LARGE) | ||
TIMEOUT(600) | ||
|
||
IF (BENCHMARK_MAKE_LARGE_PART) | ||
CFLAGS( | ||
-DBENCHMARK_MAKE_LARGE_PART=1 | ||
) | ||
TIMEOUT(1200) | ||
ENDIF() | ||
|
||
SRCS( | ||
write.cpp | ||
) | ||
|
||
PEERDIR( | ||
library/cpp/testing/unittest | ||
ydb/library/binary_json | ||
ydb/library/yql/minikql/dom | ||
ydb/library/yql/minikql/invoke_builtins/llvm14 | ||
ydb/library/yql/public/udf/service/exception_policy | ||
ydb/library/yql/core/issue/protos | ||
ydb/library/yql/sql/pg_dummy | ||
) | ||
|
||
YQL_LAST_ABI_VERSION() | ||
|
||
END() |
Oops, something went wrong.