Descriptionencoding/gob: remove unsafe, use reflection.
This removes a major unsafe thorn in our side, a perennial obstacle
to clean garbage collection.
Not coincidentally: In cleaning this up, several bugs were found,
including code that reached inside by-value interfaces to create
pointers for pointer-receiver methods. Unsafe code is just as
advertised.
Performance of course suffers, but not too badly. The Pipe number
is more indicative, since it's doing I/O that simulates a network
connection. Plus these are end-to-end, so each end suffers
only half of this pain.
The edit is pretty much a line-by-line conversion, with a few
simplifications and a couple of new tests. There may be more
performance to gain.
BenchmarkEndToEndByteBuffer 2493 3033 +21.66%
BenchmarkEndToEndPipe 4953 5597 +13.00%
Fixes issue 5159.
Patch Set 1 #Patch Set 2 : diff -r e44ac88898a1 https://code.google.com/p/go #Patch Set 3 : diff -r 363e78454ccd https://code.google.com/p/go #
Total comments: 24
Patch Set 4 : diff -r 1fcd603852b0 https://code.google.com/p/go #
MessagesTotal messages: 5
|