Geethapranay1 commented on PR #3580: URL: https://github.com/apache/fory/pull/3580#issuecomment-4270371974
added a few more things in the latest commit: - switched from` copy_nonoverlapping` to `write_unaligned` for the fixed primitive `put_*_at` methods. Removes the temporary stack reference overhead. - batched the varint byte writes into wider u16/u32 stores, same way the existing `_write_var_uint32` already does it. - fixed a missing 8-byte case in `put_var_uint64_`at that I accidentally dropped in the earlier commit. Reran benchmarks on both branches, same machine, back to back. main branch: <img width="1800" height="750" alt="struct" src="https://github.com/user-attachments/assets/4bb47f05-2450-4233-bc90-f5aa7b9ff3ad" /> ## Benchmark Results ### Timing Results (nanoseconds) | Datatype | Operation | fory (ns) | protobuf (ns) | Fastest | |----------|-----------|-----------|---------------|---------| | Struct | Serialize | 115.0 | 189.8 | fory | | Struct | Deserialize | 62.0 | 116.6 | fory | | Sample | Serialize | 174.3 | 962.4 | fory | | Sample | Deserialize | 306.8 | 1322.7 | fory | | MediaContent | Serialize | 351.7 | 582.1 | fory | | MediaContent | Deserialize | 497.5 | 910.1 | fory | | StructList | Serialize | 269.3 | 939.6 | fory | | StructList | Deserialize | 228.4 | 736.9 | fory | | SampleList | Serialize | 637.3 | 6523.7 | fory | | SampleList | Deserialize | 2167.2 | 7059.6 | fory | | MediaContentList | Serialize | 1158.0 | 3967.8 | fory | | MediaContentList | Deserialize | 2731.3 | 5433.4 | fory | ### Throughput Results (ops/sec) | Datatype | Operation | fory TPS | protobuf TPS | Fastest | |----------|-----------|----------|--------------|---------| | Struct | Serialize | 8,696,408 | 5,269,259 | fory | | Struct | Deserialize | 16,141,789 | 8,573,388 | fory | | Sample | Serialize | 5,737,564 | 1,039,058 | fory | | Sample | Deserialize | 3,259,346 | 756,029 | fory | | MediaContent | Serialize | 2,843,332 | 1,717,859 | fory | | MediaContent | Deserialize | 2,009,929 | 1,098,780 | fory | | StructList | Serialize | 3,713,331 | 1,064,260 | fory | | StructList | Deserialize | 4,377,325 | 1,356,999 | fory | | SampleList | Serialize | 1,569,120 | 153,287 | fory | | SampleList | Deserialize | 461,425 | 141,651 | fory | | MediaContentList | Serialize | 863,558 | 252,029 | fory | | MediaContentList | Deserialize | 366,126 | 184,047 | fory | this pr: <img width="1800" height="750" alt="struct" src="https://github.com/user-attachments/assets/ec93242a-9feb-4baa-9219-ec18246fe559" /> ## Benchmark Results ### Timing Results (nanoseconds) | Datatype | Operation | fory (ns) | protobuf (ns) | Fastest | |----------|-----------|-----------|---------------|---------| | Struct | Serialize | 112.7 | 212.1 | fory | | Struct | Deserialize | 61.9 | 103.1 | fory | | Sample | Serialize | 183.0 | 949.8 | fory | | Sample | Deserialize | 301.5 | 1275.4 | fory | | MediaContent | Serialize | 349.4 | 567.6 | fory | | MediaContent | Deserialize | 489.0 | 896.8 | fory | | StructList | Serialize | 247.0 | 999.5 | fory | | StructList | Deserialize | 225.9 | 669.3 | fory | | SampleList | Serialize | 641.8 | 6174.4 | fory | | SampleList | Deserialize | 2169.7 | 6931.8 | fory | | MediaContentList | Serialize | 1171.5 | 3914.1 | fory | | MediaContentList | Deserialize | 2733.3 | 5389.5 | fory | ### Throughput Results (ops/sec) | Datatype | Operation | fory TPS | protobuf TPS | Fastest | |----------|-----------|----------|--------------|---------| | Struct | Serialize | 8,875,477 | 4,714,090 | fory | | Struct | Deserialize | 16,157,960 | 9,698,380 | fory | | Sample | Serialize | 5,463,884 | 1,052,809 | fory | | Sample | Deserialize | 3,316,970 | 784,068 | fory | | MediaContent | Serialize | 2,862,213 | 1,761,773 | fory | | MediaContent | Deserialize | 2,044,906 | 1,115,088 | fory | | StructList | Serialize | 4,048,911 | 1,000,520 | fory | | StructList | Deserialize | 4,426,737 | 1,494,076 | fory | | SampleList | Serialize | 1,558,215 | 161,959 | fory | | SampleList | Deserialize | 460,893 | 144,263 | fory | | MediaContentList | Serialize | 853,606 | 255,487 | fory | | MediaContentList | Deserialize | 365,858 | 185,546 | fory | - Struct Serialize: 115.0ns -> 112.7ns (2% faster) - StructList Serialize: 269.3ns -> 247.0ns (8.3% faster) - Serialized data sizes are the same across all types. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
