kevin-montrose/Jil — pull request #69 by manofstick (2014-09-17 11:10:12+00:00)
Title: Unsafe write encoded string 3

Another attempt at getting WriteEncodedString* across the line. This one is using the existing CharBuffer, and has removed the expanding component; so we shouldn't have any of the concerns that we have with the deserializer. I have included your original speed test (which does 'fail' sometimes, marginally), as well as the speed test with the list of objects. I have also made the code fully switchable with UseBufferedStringWriting flag.

Personally I think the buffer should be larger, but I'm trying to do the bare minimum to fit this in.

Existing master

Serializing
===========
Single:
Type Jil Static MS Jil Static Jil Dynamic MS Jil Dynamic
User 0.0205 0.0205
Answer 0.0861 0.0861
Question 0.52535 0.5198

Lists:
Type Jil Static MS Jil Static Jil Dynamic MS Jil Dynamic
User 0.1035 0.103
Answer 0.3181 0.3194
Question 1.7821 1.7672

Dictionaries of strings to:
Type Jil Static MS Jil Static Jil Dynamic MS Jil Dynamic
User 0.6072 0.609
Answer 2.10115 2.1344
Question 7.7844 7.77235

Using the 36-byte buffer

Serializing
===========
Single:
Type Jil Static MS Jil Static Jil Dynamic MS Jil Dynamic
User 0.0169 0.0165
Answer 0.0548 0.0557
Question 0.3632 0.36025

Lists:
Type Jil Static MS Jil Static Jil Dynamic MS Jil Dynamic
User 0.0731 0.0731
Answer 0.2146 0.2146
Question 1.2257 1.22415

Dictionaries of strings to:
Type Jil Static MS Jil Static Jil Dynamic MS Jil Dynamic
User 0.4252 0.4272
Answer 1.49945 1.4903
Question 5.755 5.6945

Doubleing the buffer to 72-byte-buffer

Serializing
===========
Single:
Type Jil Static MS Jil Static Jil Dynamic MS Jil Dynamic
User 0.0133 0.0133
Answer 0.0481 0.0481
Question 0.3279 0.327

Lists:
Type Jil Static MS Jil Static Jil Dynamic MS Jil Dynamic
User 0.0678 0.0682
Answer 0.1949 0.1936
Question 1.1039 1.10725

Dictionaries of strings to:
Type Jil Static MS Jil Static Jil Dynamic MS Jil Dynamic
User 0.4007 0.3948
Answer 1.3966 1.3944
Question 5.5145 5.53215

Obviously this is a replacement for the other pull request if this one is accepted.