summaryrefslogtreecommitdiffstats
path: root/contrib/libs/python/Include_prev/bytesobject.h
diff options
context:
space:
mode:
authorthenewone <[email protected]>2025-08-04 20:25:02 +0300
committerthenewone <[email protected]>2025-08-04 21:30:57 +0300
commit140e5db975aa31e2326abb3b5bd58a6e142075c6 (patch)
tree48258c7ab5d06aea1a36cab4a568bd9f044394f4 /contrib/libs/python/Include_prev/bytesobject.h
parent77ae0a1260666d7ad2baf248ecd24200b337dd4d (diff)
Don't construct twice yson struct members of yson struct lite type
There is a serious problem of all yson structs: their members are constructed twice when the yson struct is constructing: the first time implicitly as common members, and the second time explicitly right in yson struct constructor's body. So if any yson struct A has a member of yson struct lite type B, then per one A's construction the B will be constructed twice. If in turn B has a member of yson struct lite type C then it will be contructed two time per B's contruction and four times per A's construction. The next level D will be constructed 8 times etc, generally giving compexity of 2^N for construction of yson struct lite chain of length N. This patch solves the most common case when yson struct lite member is declared as .Default() or .Otional(). In this case ther's no need to construct the member the second time. This gives improvement from: ``` BenchmarkDecode<TDeepStructLite> 88384 ns 88365 ns 7578 items_per_second=11.3167k/s ``` To: ``` BenchmarkDecode<TDeepStructLite> 35361 ns 35359 ns 19786 items_per_second=28.2814k/s ``` Part 3 of https://nda.ya.ru/t/E9Ji-1bm7Gwv6c commit_hash:b8a3db2cdc4393bae38b7310047cc3fcd9b9a15c
Diffstat (limited to 'contrib/libs/python/Include_prev/bytesobject.h')
0 files changed, 0 insertions, 0 deletions