TJ Yin
90d · built 2026-11-22
Performance
What TJ Yin shipped in the selected window, measured in ETV, and how it compares with the 90 days before it.
Effective capacity
+4.8engineers
delivers like 5.8 (5.8x pre-AI)
Output (ETV)
27.1ETV
+1306.2% vs 1.9 prior
Features share
16.2%
−16.4 pp vs prior window
Fixes share
24.4%
+3.7 pp vs prior window
Work mix
16.2% Features12.1% Maintenance45.5% Tests1.7% Docs24.4% Fixes
293 commits over 90 days, ending 2026-11-22.
Daily performance
Daily ETV, stacked by Features, Maintenance, Tests, Docs and Fixes.
Repository spread
Where this developer's commits land. Concentrated work (top1 > 80%) vs polymath spread (top1 < 30%).
Most impactful commits
Top 10 by ETV in the last 90 days.
- 0.6ETVThe C++ generator gives `@cpp.Arena` fields PMR types Summary: ## In this stack Implement `cpp.Arena`, which lets Thrift C++ strings and containers allocate from a `std::pmr::memory_resource` such as an arena. ## In this diff **Before:** `cpp.Arena` on a field did nothing. **After:** a string, binary or container field with `cpp.Arena` gets the C++ type `pmr::Rebind<T>::type`, where `T` is its C++ type without `cpp.Arena`, including any `cpp.Type`. Its strings and containers at every level use `std::pmr::polymorphic_allocator`. Until D130245675, they allocate from the default resource. | Field | C++ type | |---|---| | `cpp.Arena 1: string name` | `std::pmr::string` | | `cpp.Arena 2: map<string, list<string>> groups` | `std::pmr::map<std::pmr::string, std::pmr::vector<std::pmr::string>>` | | `cpp.Arena cpp.Type{template = "std::unordered_map"} 3: map<string, string> custom` | `std::pmr::unordered_map<std::pmr::string, std::pmr::string>` | Their type tags are `type::cpp_pmr_type` (D130001471), so the tags of nested levels match their PMR types. Move assignment of a struct or union with arena fields, or holding one, isn't `noexcept` (D130325430), and `swap` handles arena fields on different resources (D130587088). Types with arena fields are allocator-aware (D130245675), so `tablebased`, `frozen` and `frozen2` reject them (D130722154), and a field whose type nests an `IOBufPtr` can't have `cpp.Arena` (D130324362). ## Decisions - The thrift-python C API serializes structs with `cpp.Arena` fields, because its marshaling converts `std::` strings and containers. py3 rejects them (D130587746). - `frozen2` doesn't support `cpp.Arena` fields: Frozen has no layouts for PMR types, so a struct that has them needs `cpp.Frozen2Exclude` with `frozen2`. - Only the generated headers of programs with `cpp.Arena` fields include `Rebind.h`, so other programs don't pull in its headers, such as `sorted_vector_types.h`. Struct constants that set `cpp.Arena` fields don't always compile yet (D130027327), and `cpp.Arena` on a struct or union still does nothing (D129978490). Reviewed By: vitaut Differential Revision: D129420942 fbshipit-source-id: 7df59ada27802f4df09ac6413d258f7357aa945cgithub.com-facebook-fbthrift · 8ba7bd5c · 2026-11-10
- 0.5ETVReport malformed input as TProtocolException Summary: Binary, Compact and SimpleJSON report malformed input as `protocol::TProtocolException`. The JSON5 reader used other exception types, so callers catching `TProtocolException` missed them: | Where | Threw | | --- | --- | | `Json5Reader::throwParseError`, `Json5ProtocolReader::throwError` | `std::runtime_error` | | `folly::to` on out-of-range numbers, e.g. `{"i32Value": 3000000000}` | `folly::ConversionError` | | Invalid base64 in a binary value | `folly::base64_decode_error` | | Trailing content in `Json5ProtocolUtils::fromJson5` | `std::runtime_error` | All of them now throw `TProtocolException(INVALID_DATA)`. Existing messages are unchanged. Numeric conversions go through `folly::tryTo` (`parseNumberOrThrow` in the lexer, `Json5ProtocolReader::convertTo` in the protocol reader). **Behavior change:** only the exception type, and only for input that was already rejected. `TProtocolException` is not a `std::runtime_error`; nothing in fbsource catches `std::runtime_error` around JSON5 decoding. thrift-python raises `thrift.python.exceptions.Error` either way. The `std::bad_variant_access` thrown for type-mismatched input is fixed in the next diff. Reviewed By: vitaut Differential Revision: D121721547 fbshipit-source-id: 2528991728bcc9b726a6e4c1506b0a036313b729github.com-facebook-fbthrift · 3a433c78 · 2026-09-26
- 0.5ETVTypes with `@cpp.Arena` fields take a PMR allocator Summary: ## In this stack Implement `cpp.Arena`, which lets Thrift C++ strings and containers allocate from a `std::pmr::memory_resource` such as an arena. ## In this diff **Before:** `cpp.Arena` fields always allocated from the default memory resource. **After:** a struct, union or exception with `cpp.Arena` fields takes a `std::pmr::polymorphic_allocator<std::byte>` and passes it to those fields, including when deserializing: ``` std::pmr::monotonic_buffer_resource arena; S s{&arena}; CompactSerializer::deserialize(buf, s); // s's arena fields allocate from `arena` ``` `cpp.Arena` is also allowed on a struct or union field whose type takes an allocator. Like on a string or container field, it makes the field `cpp.use_allocator`, so the field gets its struct's allocator, and struct-level `cpp.Arena` covers such fields too: ```lang=thrift struct Inner { cpp.Arena 1: string name; } struct Outer { cpp.Arena 1: Inner inner; // allocates from `Outer`'s memory resource } ``` From the `cpp-arena` fixture: ```lang=diff class Fields final { + public: + using allocator_type = ::std::pmr::polymorphic_allocator<::std::byte>; + allocator_type get_allocator() const { + return __fbthrift_alloc; + } ... + explicit Fields(const allocator_type& alloc) noexcept; + explicit Fields(const Fields& other, const allocator_type& alloc); + explicit Fields(Fields&& other, const allocator_type& alloc); ``` ## Decisions - A declared `internal.CppAllocator` or `cpp.allocator` takes precedence; the arena fields must then be constructible from it. - The existing allocator rules apply (custom defaults, `cpp.Ref`, `cpp.Lazy`, `tablebased`, `frozen` and `frozen2`). Their errors that named `cpp.allocator` now say "allocator-aware", since `cpp.Arena` types hit them too. Reviewed By: iahs Differential Revision: D130245675 fbshipit-source-id: 5befaf317da957e7e84164eee64aa1323f38beaegithub.com-facebook-fbthrift · e43696ba · 2026-11-11
- 0.5ETVShare the language-agnostic JSON5 test cases kept inline in C++ Summary: Several JSON5 cases lived only in C++ tests, so a new implementation (Hack is next) could not reuse them. Move the ones that do not depend on the C++ API into the shared `.thrift` files, which C++ and thrift-python now read from there: - `json5_reader_test.thrift` (new): 137 syntax cases from `JsonReaderTest`, independent of any Thrift schema. Each pairs raw input bytes with the value written back as compact JSON, or with nothing if the input must be rejected. `Json5Transcoder` does the reading and writing for the C++ test, and `JsonWriter` gains `writeNull()` for it. - `json5_test.thrift`: `Example` gains `doubleListValue`, `floatListValue`, `doubleAsKey` and `floatAsKey`, used by new golden cases for the text of doubles and floats (including float `16777216`, which a newer fmt would write in scientific notation), floating-point map keys and non-BMP strings. - `json5_compatibility_test.thrift`: `RoundTripTestCase` covers what constants cannot express: NaN, the infinities and negative zero. Each input must decode to a value written as the given `json` and `json5`. New compatibility cases cover surrogate-pair escapes and floating-point keys read from integers. - `json5_negative_test.thrift`: the extra rejected inputs from `JsonDecoderNegativeTest` and the floating-point key cases, plus `invalidUtf8NegativeCases`, whose inputs are `binary` as they are not valid UTF-8. thrift-python skips `ExtraClosingBracket` and `CommaAfterTopLevelValue`, as it does not reject content after the value yet. ___ landed-with-radar-review Differential Revision: D127629625 fbshipit-source-id: dac378ece5964c5efdc16ec6df6793f1f1e62344github.com-facebook-fbthrift · d17f93c0 · 2026-10-26
- 0.4ETVFix the check that turns on bulk read and write for lists of numbers Summary: `op::encode` and `op::decode`, which generated code uses, never read or write lists of numbers in bulk (`writeArithmeticVector`/`readArithmeticVector`), because `should_process_as_arithmetic_vector_v` is always false. It ends with: ```lang=cpp requires(typename ContainerType::value_type* value, size_t len) { Protocol::writeArithmeticVector(value, len); }; ``` `writeArithmeticVector` is a non-static member function, so calling it without an object never compiles. The check now tests the calls the encoder and decoder make, on an object: ```lang=diff folly::is_contiguous_range_v<ContainerType> && - requires(typename ContainerType::value_type* value, size_t len) { - Protocol::writeArithmeticVector(value, len); - }; + (requires(Protocol& prot, ContainerType& list) { + prot.writeArithmeticVector(list.data(), list.size()); + } || requires(Protocol& prot, ContainerType& list) { + prot.readArithmeticVector(list.data(), list.size()); + }); ``` Writers have only `writeArithmeticVector` and readers only `readArithmeticVector`, so each side passes only its own check. A container whose `data()` isn't a pointer keeps the per-element path. If a bulk read throws on truncated or invalid input, the list's elements are zero-filled, as the per-element path does, instead of keeping stale or uninitialized values. The wire bytes don't change. BinaryProtocol takes the bulk path on every platform. CompactProtocol takes it only on ARM with SVE until D132426931 and D132398889 turn it on for x86. ## Results ProtocolBench, `fbcode//mode/opt-clang-thinlto`, AMD EPYC Genoa, one pinned CPU, best of 3, µs per 10000-element list: | List | Write before | Write after | Speedup | Read before | Read after | Speedup | | --- | --- | --- | --- | --- | --- | --- | | `BigListByte` | 6.84 | 0.179 | 38.3x | 5.13 | 0.114 | 45.0x | | `BigListShort` | 5.91 | 0.346 | 17.1x | 5.15 | 0.210 | 24.5x | | `BigListInt` | 6.96 | 0.784 | 8.88x | 5.68 | 0.794 | 7.15x | | `BigListBigInt` | 13.9 | 1.52 | 9.13x | 5.40 | 1.35 | 3.99x | | `BigListFloat` | 6.02 | 0.776 | 7.76x | 5.36 | 0.788 | 6.81x | | `BigListDouble` | 6.25 | 1.52 | 4.11x | 5.40 | 1.36 | 3.97x | The `OpEncodeBinaryProtocol_*` rows of the same lists improve by 3.76x to 44.9x. ## Alternatives Call it on an object: ```lang=diff - requires(typename ContainerType::value_type* value, size_t len) { - Protocol::writeArithmeticVector(value, len); + requires( + Protocol& prot, typename ContainerType::value_type* value, size_t len) { + prot.writeArithmeticVector(value, len); }; ``` This then fails to build (`no matching member function for call to 'writeArithmeticVector'`) for a list whose `cpp.Type{template = ...}` container has a `data()` that returns something other than a pointer, such as `const std::vector<int32_t>&`: the check passes a `value_type*`, but the call passes `list.data()`. Reviewed By: iahs Differential Revision: D132041028 fbshipit-source-id: c2ee5b0fc6853a169047c8a5344d07d013008f2fgithub.com-facebook-fbthrift · 7c187e7c · 2026-11-18
- 0.4ETVEnforce the protocol depth limit on nested values Summary: `Json5ProtocolReader` and `Json5ProtocolWriter` now derive from `detail::ProtocolBase` and call `descend()`/`ascend()` in struct, map, list and set begin/end, like Binary, Compact and SimpleJSON. The reader also counts every object and array level in `skip()`, so skipped values share the same budget. Nesting deeper than `FLAGS_thrift_protocol_max_depth` throws `TProtocolException(DEPTH_LIMIT)`. `Json5ProtocolWriter.h` now includes `Protocol.h`, and the writer target exports `protocol_base`. ___ Differential Revision: D121721549 fbshipit-source-id: 8a544adcc706b00ef79dba0792fae12feb1feb7egithub.com-facebook-fbthrift · 3db3b96a · 2026-09-27
- 0.4ETVBugfix: Decode `cpp.type`s that request `protocol_methods` Summary: **TL;DR:** `op::decode` now honors `__fbthrift_use_protocol_methods` on a `cpp.type`, as `op::encode` already does, instead of trying to decode the type as a standard container or string. ## Why A `cpp.type` can define `__fbthrift_use_protocol_methods` to say that only its `protocol_methods` specialization can (de)serialize it. arvr's `ThriftMatrix<Eigen::Matrix<...>>`, used as a `list<double>` or `binary`, is one. `op::encode` honors this through `ProtocolMethodsBridge::write`; `op::decode` ignored it. ## Example of the bug ``` op::decode<type::cpp_type<ThriftMatrix<Eigen::MatrixXd>, type::list<type::double_t>>>(prot, m); // error: no type named 'reference' in 'ThriftMatrix<...>' // error: no member named 'append' in 'ThriftMatrix<...>' ``` ## Changes - New `ProtocolMethodsBridge::read`, next to `write`. - `Decode<cpp_type<T, Tag>>` uses it when `T` requests `protocol_methods`, reusing `op::encode`'s `requestedBypass` check. Reviewed By: iahs Differential Revision: D123005311 fbshipit-source-id: 7bf747411e6366c544ba9f83e7406f7fec1e3cf0github.com-facebook-fbthrift · ff5e6b69 · 2026-10-06
- 0.4ETVFix list encode and decode skipping per-element adapters Summary: `op::encode` and `op::decode` write and read a list of numbers in bulk when the protocol supports it (D132041028). That check looks only at the wire type and the container's element type, so a list of adapted numbers whose adapted type is itself a number takes the bulk path too, and the adapter's `toThrift`/`fromThrift` never runs: ```lang=cpp struct OffByOneAdapter { static int32_t fromThrift(int32_t value) { return value - 1; } static int32_t toThrift(int32_t value) { return value + 1; } }; std::vector<int32_t> list; op::decode<type::list<type::adapted<OffByOneAdapter, type::i32_t>>>( reader, list); // Before: the values on the wire. After: each value minus one. ``` This affects BinaryProtocol on every platform and CompactProtocol on ARM with SVE. Adapted elements now always go through `Encode<adapted<...>>`/`Decode<adapted<...>>` one at a time. Lists of unadapted numbers, `cpp_type` ones included, still take the bulk path, and `protocol_methods` (which has no adapted elements) is unchanged. Reviewed By: iahs Differential Revision: D132755361 fbshipit-source-id: abb53a88dbdc92617a1cf6946ae06a190c956945github.com-facebook-fbthrift · a0e8fea4 · 2026-11-18
- 0.4ETVSupport Allocator In Union #15: More tests for cpp.allocator unions Summary: **TL;DR:** More tests for `cpp.allocator` unions: every member kind, a stateful allocator, equal-allocator moves and more deserialization cases. Tests only. ## Why The existing tests check the allocator only on flat `cpp.use_allocator` members (a string, a list or set of ints). These check that the allocator also reaches container elements and the fields of nested structs and unions, and cover a stateful allocator that does not propagate. ## Notes New tests: - `UnionPmr` members `aa_string_list`, `aa_map`, `aa_child` and `aa_inner`, exercised by the copy, move, assignment, swap, container, `op::decode` and deserialization tests. - `StatefulUnion` (`ScopedStatefulAlloc`): copies and a deserialization round trip. - `FieldRefUsesUnionAllocatorForNestedMembers`. - `EqualAllocatorMovesTakeOverMember`, with the new `RefChildUnionPmr` whose member struct has a `cpp.ref` field: moves between equal allocators keep that field's pointer and allocate nothing. - `EmptyUnionKeepsAllocator` and `UnionInsideAllocatorAwareStruct` for each serializer. ___ landed-with-radar-review Differential Revision: D124167217 fbshipit-source-id: b8afd22e23154a0cd6af284715fd0826de3728c4github.com-facebook-fbthrift · dc58c533 · 2026-10-20
- 0.3ETVOptimize CompactProtocol's bulk i64 list reader on 9- and 10-byte varints by decoding their first 8 bytes at once Summary: The bulk list reader decodes `i64` varints with `readVarintMediumSlowUnrolled`, which branches once per byte. On 9- and 10-byte varints (for example hashes) that makes it slower than reading each element, which takes the 7 value bits out of 8 bytes in one instruction. This decodes those varints the same way. ``` readVarint(int64_t& value, bytes): // bytes: the next 10 bytes of input if the varint is at most 8 bytes long: return readVarintMediumSlowUnrolled(value, bytes) // as before if the varint is longer than 10 bytes: throw value = the first 8 bytes without their continuation bits // bits 0-55 | the 9th byte without its continuation bit // bits 56-62 | the 10th byte, if there is one // bit 63 return the varint's length (9 or 10) ``` ProtocolBench on x86 (`mode/opt-clang-thinlto`, one pinned CPU, best of 3), µs per 10000-element list, measured with D132426931's x86 opt-in applied: | Row | Per element | This diff | | --- | --- | --- | | `CompactProtocol_read_BigListWideBigInt` (9–10 byte varints) | 36.5 | 26.6 | | `CompactProtocol_read_BigListBigInt` (5-byte varints) | 36.6 | 26.5 | The decoders read the maximum varint length (10 bytes for `i64`, 5 for `i32`) however long the varint is, so `readVarint` takes that size as a fixed-extent `std::span` instead of a raw pointer. Bulk reads run only on ARM with SVE until D132426931 turns them on for x86. `compact_protocol_arithmetic_vector_test` checks the bulk reader against lists written one element at a time: - every `i32` value - every `i16` value - about 2M `i64` values per zigzag bit width, with varint lengths mixed - every varint length, through 7-byte input buffers - lists of 0 to 3 elements - overlong varints (11-byte `i64`, 6-byte `i32`), which must be rejected both with room for a pair and at the end of the input ### How `pext` works `readVarint` decodes the first 8 bytes with BMI2's `pext` (parallel bit extract, `_pext_u64`). It takes the bits of `src` at the mask's 1-positions and packs them to the right: ``` pext(0b100110, 0b10110110) == 0b1011 mask: 1 0 1 1 0 1 1 0 (5 bits set in mask) │ │ │ │ │ src: 0 0 1 0 0 1 1 0 │ │ │ │ │ │ │ │ │ └─┐ │ │ │ └─┐ │ │ │ └───┐ │ │ │ └───┐ │ │ │ └─────┐ │ │ │ │ ▼ ▼ ▼ ▼ ▼ result: 0 0 0 0 1 0 1 1 (extracted bits packed to the right) ``` With mask `0x7f7f`, `pext` drops each byte's continuation bit and joins the 7-bit groups. For the varint of 300 (bytes `AC 02`, loaded little-endian as `0x02AC`): ``` pext(0x02AC, 0x7f7f) == 300 mask: 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 (0x7f7f) │ │ │ │ │ │ │ │ │ │ │ │ │ │ src: 0 0 0 0 0 0 1 0 1 0 1 0 1 1 0 0 (0x02AC) │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─┐ │ │ │ │ │ │ │ │ │ │ │ │ └─┐ │ │ │ │ │ │ │ │ │ │ │ │ └─┐ │ │ │ │ │ │ │ │ │ │ │ │ └─┐ │ │ │ │ │ │ │ │ │ │ │ │ └─┐ │ │ │ │ │ │ │ │ │ │ │ │ └─┐ │ │ │ │ │ │ │ │ │ │ │ │ └─┐ │ │ │ │ │ │ │ │ │ │ │ │ │ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ result: 0 0 0 0 0 0 0 1 0 0 1 0 1 1 0 0 (300) ``` Reviewed By: iahs Differential Revision: D132426930 fbshipit-source-id: 296221a20cc4590278beda5adb446152bb11a064github.com-facebook-fbthrift · b80333e8 · 2026-11-18