<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ydb/library/cpp/yt/system/benchmarks/tscp.cpp, branch CLI_2.32.0</title>
<subtitle>Mirror of YDB github repos</subtitle>
<id>https://code.mastervirt.ru/ydb/atom?h=CLI_2.32.0</id>
<link rel='self' href='https://code.mastervirt.ru/ydb/atom?h=CLI_2.32.0'/>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/'/>
<updated>2026-06-18T10:04:31Z</updated>
<entry>
<title>Add TTscp::GetApproximate</title>
<updated>2026-06-18T10:04:31Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2026-06-18T09:20:33Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=50fd836ab1e51d127495bb37dab3888b27e0ce09'/>
<id>urn:sha1:50fd836ab1e51d127495bb37dab3888b27e0ce09</id>
<content type='text'>
TTscp::GetApproximate takes the processor id from the rseq fast path
(GetCurrentCpuId) and the instant from a non-serializing rdtsc, instead of the
single serializing rdtscp of TTscp::Get.

TPerCpuGauge::Update switches to it: the per-shard timestamp only orders writes
across shards to pick the freshest value, so the lower precision is fine. Update
is virtual and now YT_PREVENT_TLS_CACHING -- the fiber-TLS boundary the inlined
rseq read needs.

#### Benchmark

sas2-2769 (glibc 2.31 + tcmalloc, rseq fast path), median of 5:

| primitive | time |
|---|---|
| TTscp::Get() (rdtscp) | 14.1 ns |
| TTscp::GetApproximate() (rseq + rdtsc) | 10.6 ns (-25%) |
commit_hash:b277b6551accd6d0b879f8ffb168bcbe8d9fbb74
</content>
</entry>
</feed>
