diff options
author | Grigory Reznikov <gritukan@nebius.com> | 2024-03-19 13:38:52 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-03-19 14:16:23 +0300 |
commit | 51c750cf25c79121b833e2a7882b10e8cd371bef (patch) | |
tree | c4e54afd7028d5f1b9859ecb54b287994cc6eee7 /contrib/libs/clapack/spprfs.c | |
parent | 7bfb3ae386d49f6392b1e4fcc8b6f1c43940f27c (diff) | |
download | ydb-51c750cf25c79121b833e2a7882b10e8cd371bef.tar.gz |
Support building yt/cpp and yt/yt/core with vanilla protobuf
After this PR yt/cpp and yt/yt/core are possible to be built both with Arcadia protobuf (that uses TString as a string) and vanilla protobuf (that uses std::string as a string). To achieve so, a couple of interoperability primitives are introduced.
* `TProtobufString` is an alias to protobuf string type, i.e. it can be `TString` or `std::string` depending on the protobuf implementation.
* `IsVanillaProtobuf` and `IsArcadiaProtobuf` are the constexpr boolean values that allow to check protobuf implementation both in the compile time and runtime.
The most challenging interoperability issue solved here is a string copy between protobuf message and C++ code that has a form of `TString str = msg.str()`. This code works perfect with Arcadia protobuf but does not work with vanilla protobuf. To solve it, a previously introduced primitive `FromProto<TString>` is used. This expression makes the most efficient cast possible between protobuf string and C++ string. Internally, it is just a copy in both cases. Since TString is CoW by default, this expression is almost zero-cost (actually it's just one atomic operation), so no degradation is expected for YTsaurus server builds. The most hot code is handled differently to avoid even atomic operations (see `GetRequestTargetYPath`). In case of vanilla protobuf string is copied, however there are no places in C++ SDK where it might be a problem. If such issues would appear, performance-critial code can be rewritten in `GetRequestTargetYPath`-style.
---
1a6f3e02cb6e83915102c24b73bc8734f6a48e74
Pull Request resolved: https://github.com/ytsaurus/ytsaurus/pull/466
Diffstat (limited to 'contrib/libs/clapack/spprfs.c')
0 files changed, 0 insertions, 0 deletions