Azure / azure-amqp

AMQP C# library
Other
94 stars 70 forks source link

Encoding improvements #194

Closed xinchen10 closed 3 years ago

xinchen10 commented 3 years ago
Benchmark results for a few types. master Method Mean Error StdDev Gen 0 Gen 1 Gen 2 Allocated
ArrayAmqpSymbolDecode_1M_MAA 465.639 us 6.6509 us 5.8958 us 63.4766 20.5078 - 401,352 B
ArrayAmqpSymbolDecode_1K_MAA 44.038 us 0.6980 us 0.6187 us 6.4697 0.7935 - 40,616 B
ArrayAmqpSymbolEncode_100K_MAA 855.711 us 9.8138 us 8.6997 us - - - -
ArrayAmqpSymbolEncode_1K_MAA 85.426 us 1.6848 us 2.1307 us - - - -
Bytes_Encode_MAA 63.509 us 1.0021 us 0.9374 us - - - -
Bytes_Decode_MAA 541.192 us 9.9670 us 8.8355 us 7.8125 7.8125 7.8125 1,048,602 B
ArrayInt32Encode_MAA_1M 1,284.971 us 24.7774 us 21.9646 us - - - 1 B
ArrayInt32Encode_MAA_1K 1.335 us 0.0219 us 0.0183 us - - - -
ArrayInt32Decode_1M_MAA 2,764.622 us 38.2358 us 31.9286 us 31.2500 31.2500 31.2500 4,194,338 B
ArrayInt32Decode_1K_MAA 1.558 us 0.0268 us 0.0251 us 0.6561 - - 4,120 B
After changes Method Mean Error StdDev Gen 0 Gen 1 Gen 2 Allocated
ArrayAmqpSymbolDecode_1M_MAA 504.052 us 9.6789 us 12.5853 us 63.4766 20.5078 - 401,352 B
ArrayAmqpSymbolDecode_1K_MAA 47.470 us 0.9227 us 0.9476 us 6.4697 0.7935 - 40,616 B
ArrayAmqpSymbolEncode_100K_MAA 422.250 us 8.3635 us 7.8233 us - - - -
ArrayAmqpSymbolEncode_1K_MAA 41.042 us 0.7985 us 0.9806 us - - - -
Bytes_Encode_MAA 64.252 us 0.6440 us 0.5378 us - - - -
Bytes_Decode_MAA 590.887 us 11.8172 us 20.6968 us 7.8125 7.8125 7.8125 1,048,600 B
ArrayInt32Encode_MAA_1M 1,303.097 us 10.0692 us 7.8614 us - - - -
ArrayInt32Encode_MAA_1K 1.274 us 0.0082 us 0.0072 us - - - -
ArrayInt32Decode_1M_MAA 3,243.336 us 51.3179 us 48.0028 us 39.0625 39.0625 39.0625 4,194,328 B
ArrayInt32Decode_1K_MAA 1.885 us 0.0313 us 0.0278 us 0.6561 - - 4,120 B

There is a very small different because now all encoding implementations call AmqpBitConverter to do the work, instead of accessing the buffer directly. This difference should not have any impact on real world uses.

danielmarbach commented 2 years ago

Can we get those changes also somehow back ported to a minor version? Yes, it requires new dependencies, but that would be totally fine in a minor in my viewpoint

That would be wonderful // cc @JoshLove-msft @jsquire

xinchen10 commented 2 years ago

It depends on a previous bigger change and introduces some breaking changes last time when I looked at it. The current focus is to get a major version released from master.