<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ydb/library/cpp/yt/misc, branch main</title>
<subtitle>Mirror of YDB github repos</subtitle>
<id>https://code.mastervirt.ru/ydb/atom?h=main</id>
<link rel='self' href='https://code.mastervirt.ru/ydb/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/'/>
<updated>2026-07-07T18:50:27Z</updated>
<entry>
<title>Make the yt and flow sources buildable in the ytsaurus-cpp-sdk export</title>
<updated>2026-07-07T18:50:27Z</updated>
<author>
<name>mikari</name>
<email>mikari@yandex-team.com</email>
</author>
<published>2026-07-07T18:20:29Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=903560d682944ba9687cd4bdf323d0b627ac4fbd'/>
<id>urn:sha1:903560d682944ba9687cd4bdf323d0b627ac4fbd</id>
<content type='text'>
 Make the yt and flow sources buildable in the ytsaurus-cpp-sdk export
commit_hash:a733ad0d534a3717117cd80d162f6d527843decd
</content>
</entry>
<entry>
<title>Address-salted ref-counted signature</title>
<updated>2026-06-27T08:28:22Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2026-06-27T08:11:30Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=c51be2dc7d8af75c61d95f40f86190c34c5d6e4b'/>
<id>urn:sha1:c51be2dc7d8af75c61d95f40f86190c34c5d6e4b</id>
<content type='text'>
Self-validating signature word at the head of every `TRefCounter` (`YT_ENABLE_REF_COUNTED_SIGNATURE`, on by default in debug) so a coredump walker can distinguish a live ref-counted object from freed-but-unreclaimed memory and locate the counter without virtual-base casts. Consumed by gdb_plugin (separate PR).
commit_hash:6696d8c26a8298be6543b1e3456de617d06417e9
</content>
</entry>
<entry>
<title>YT-22593: migrate assorted library/cpp/yt string APIs to std::string</title>
<updated>2026-06-22T07:29:43Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2026-06-22T06:49:16Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=3be2668d473b30ab780015fb612fcc81d0ca2183'/>
<id>urn:sha1:3be2668d473b30ab780015fb612fcc81d0ca2183</id>
<content type='text'>
commit_hash:bfab0d0115b50949f66878004cf718b988575734
</content>
</entry>
<entry>
<title>YT-28504: Support heterogeneous lookup in caches</title>
<updated>2026-06-19T17:53:29Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2026-06-19T17:35:37Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=77f13a22a1d248303c4d9a6ad19c6adbae202dbb'/>
<id>urn:sha1:77f13a22a1d248303c4d9a6ad19c6adbae202dbb</id>
<content type='text'>
commit_hash:acb3e84437f5bdb125d7c1807847eb5edecbb11f
</content>
</entry>
<entry>
<title>Fold TEnumTraits GetMinValue/GetMaxValue to compile time</title>
<updated>2026-06-14T16:10:22Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2026-06-14T15:50:09Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=969f69bfb876d8108e12cd731d24d3b6f984916b'/>
<id>urn:sha1:969f69bfb876d8108e12cd731d24d3b6f984916b</id>
<content type='text'>
GetMinValue()/GetMaxValue() are constexpr, but when called from a runtime
context for a large-domain enum, clang does not fold the min/max_element and
emits a runtime scan over the whole domain on every call. This is hot on the
master replay path: TEnumIndexedArray::operator[] bounds-checks against these
(e.g. TCypressManager::FindHandler), and TCompositeAutomaton::RememberReign
hits GetCurrentReign() = GetMaxValue() over the ~3300-entry EMasterReign domain
per mutation.

Bind the result to a constexpr local to force compile-time evaluation. Verified
by disasm on a 240-value sample enum: getmin() goes from a ~44-instruction
runtime scan to a single 'mov $const'. No behavior change.

Part of YT-28453 (master replay-speed optimizations).
commit_hash:7cdb969e00ba219415d80c5c8c984aa8bbde99d2
</content>
</entry>
<entry>
<title>Speed up NYT::Format</title>
<updated>2026-06-12T21:17:12Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2026-06-12T20:53:40Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=42e4b751702f065de932ef765bc6948c5e7d1e4b'/>
<id>urn:sha1:42e4b751702f065de932ef765bc6948c5e7d1e4b</id>
<content type='text'>
Profile-driven optimizations of the `Format` hot path, benchmarked against a representative master debug log (structured `"Key: %v"` messages dominated by GUIDs, strings, integers, bools and durations). Median improvements of ~15-20% across the workload, measured on a dedicated host.

Changes:
- `string_builder`: use `resize_uninitialized` in `DoReserve` to avoid zero-filling the buffer on every `Format` call.
- `format`: replace the per-argument `memchr` (`spec.Contains('n')`) with an inline scan, force-inline `RunFormatterAt`, and add a `FormatString` fast path for the common plain `%v` / empty spec.
- `guid`: rewrite `WriteGuidToBuffer` using a `clz`-derived digit count and a back-to-front fill instead of the per-magnitude branch cascade (cut from ~26% to ~12% of a GUID-heavy line). Validated against an `%x` reference over 2M random GUIDs plus edge cases.

Also adds `library/cpp/yt/string/benchmark` to track `Format` performance.

### Benchmarks

Median ns/op (lower is better), pinned core on a dedicated Xeon E5-2650 v2, 9x1s repetitions. See `library/cpp/yt/string/benchmark`.

| Benchmark | What it formats | Before | After | Speedup |
| --- | --- | ---: | ---: | ---: |
| `ManyMixedArgs` | ~18 args: GUIDs, strings, duration, ints | 1030 | 833 | -19% |
| `StringAndTwoGuids` | literal prefix + two GUIDs | 233 | 185 | -21% |
| `IntAndGuid` | one int + one GUID | 205 | 179 | -13% |
| `ManyInts` | six integers | 389 | 340 | -13% |
| `Guid` | a single GUID | 156 | 131 | -16% |
| `String` | a single string | 139 | 104 | -25% |
| `Int` | a single integer | 142 | 120 | -15% |
| `NoArgs` | a literal with no arguments | 88.8 | 85.7 | -3% |
commit_hash:ce9957a06c3ff28b2889aa65fbbddf4ca444f9fe
</content>
</entry>
<entry>
<title>Cache process/thread id getters and use them in TError origin capture</title>
<updated>2026-06-06T21:16:49Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2026-06-06T20:52:00Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=f10c7206fb31af8057446bceef9707aabaa9456e'/>
<id>urn:sha1:f10c7206fb31af8057446bceef9707aabaa9456e</id>
<content type='text'>
## Motivation
Profiling the YT master Automaton thread showed TOriginAttributes::Capture (run on every non-OK TError) spending ~60% of its time in a getpid() syscall — uncached on glibc &gt;= 2.25. NYT::GetCurrentThreadId() (gettid) feeds hot thread-affinity / log-manager checks on the same thread.

## Changes
- New library/cpp/yt/system/process_id.* with cached GetProcessId(); GetSystemThreadId() now caches the kernel tid in TLS. Both caches reset in the child after fork.
- Moved thread_name.{h,cpp} from misc to system.
- Removed GetCurrentProcessId/GetCurrentThreadId shims from yt/yt/core/misc/proc.{h,cpp}; migrated all callers to NYT::GetProcessId / NYT::GetSystemThreadId.
- TOriginAttributes::Capture uses the cached getters; recorded Tid is now the real kernel tid (matches perf/ps).
- Added microbenchmarks (library/cpp/yt/system/benchmarks, yt/yt/core/benchmarks/error.cpp).

## Microbenchmarks (release)
| | before | after |
|---|---|---|
| getpid | 101 ns | 0.33 ns |
| gettid | 102 ns | 1.64 ns |
| Capture | 161 ns | 50 ns |
| failed TError | 221 ns | 74 ns |
commit_hash:ee37ae57d61a5a2dd33daee935270f4bb93b7ff9
</content>
</entry>
<entry>
<title>Add Abseil-compatible support hashers</title>
<updated>2026-04-27T12:16:34Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2026-04-27T11:10:55Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=ac1b929087542a400ab0f55f7263c95544baa0b8'/>
<id>urn:sha1:ac1b929087542a400ab0f55f7263c95544baa0b8</id>
<content type='text'>
commit_hash:2d2808f61599fcfea314ad660585e984d50ffbb3
</content>
</entry>
<entry>
<title>YT-27872: Refactor BIND to fix ODR violations</title>
<updated>2026-04-03T12:52:56Z</updated>
<author>
<name>dann239</name>
<email>dann239@yandex-team.com</email>
</author>
<published>2026-04-03T12:15:57Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=57a36bc0bb183d5118c335e84ac02a4f61e257ef'/>
<id>urn:sha1:57a36bc0bb183d5118c335e84ac02a4f61e257ef</id>
<content type='text'>
commit_hash:25c6545fed2bffe20f7a008a218b9245896926ec
</content>
</entry>
<entry>
<title>YT-18571: Drop YT_ATTRIBUTE_NO_UNIQUE_ADDRESS in favor of Y_NO_UNIQUE_ADDRESS</title>
<updated>2026-03-23T11:26:18Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2026-03-23T10:39:31Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=db3520530fe5ae9f72f156178374fb6d29b5022f'/>
<id>urn:sha1:db3520530fe5ae9f72f156178374fb6d29b5022f</id>
<content type='text'>
commit_hash:c574736c9cbb7c6da6502dc751214d8d7f343568
</content>
</entry>
</feed>
