StratisBitcoinFullNode icon indicating copy to clipboard operation
StratisBitcoinFullNode copied to clipboard

Port BitcoinStream serialization improvement from nbitcoin

Open mikedennis opened this issue 7 years ago • 4 comments

Several commits related to using span on serialization. span should now be available in .net core 2.1

Spanify some methods https://github.com/MetacoSA/NBitcoin/commit/a2ae05eb2a7b97d0001a75b9f8714e981d6c2265#diff-7dda4c094394789c50086ac0238865a4

Improve perf of uint256 serialization if span is supported. https://github.com/MetacoSA/NBitcoin/commit/8864a47aaf22f11769d65ade609d38d18f90faa7

Remove some allocation during parsing with BitcoinStream https://github.com/MetacoSA/NBitcoin/commit/e8b5f36a9d7b80d8191d36076466d31d62c6e06d#diff-7dda4c094394789c50086ac0238865a4

Might as well do this optimization as well while in there: Do not needlessly create a VarString https://github.com/MetacoSA/NBitcoin/commit/8e17cdf906d79b4373433b52d61b4142396d6041#diff-7dda4c094394789c50086ac0238865a4

mikedennis avatar Aug 07 '18 20:08 mikedennis

Is this not available only in unsafe code?

Aprogiena avatar Aug 08 '18 08:08 Aprogiena

I believe its safe and managed. Here's a good article I found on it https://msdn.microsoft.com/en-us/magazine/mt814808.aspx I think very useful tool for low level stuff and should make porting some C++ bitcoin stuff a bit easier.

mikedennis avatar Aug 08 '18 14:08 mikedennis

Thanks, I will read that

Aprogiena avatar Aug 08 '18 17:08 Aprogiena

@mikedennis wow, that was an amazing read, thank you

Aprogiena avatar Aug 10 '18 13:08 Aprogiena