ANSI saves at least 25 GB per data copy instance, although an int would be better for the US post code. Not certain why it was built with a string there, most of the rest of the data *is* in proper numeric formats and stored as such. Bonus: input data generally ANSI or EBCDIC. Downside: '0' and 'O' stored as separate characters; due to the data origin, these should generally be treated as identical characters.
Marshalling: marshalling burns major CPU in our context. Our actual target is a rather large structured binary file (55GB+) that we have to pass entirely through multiple times per hour (200+, in the end achieved by using multiple machines - so software speed directly impacts hardware and license costs), so unsafe pointer casts to managed objects is actually what is needed for the speed. Saves a lot on the type-checking NOP's. But, it requires everything to be blittable. This heavily influences the structure.
I'll check on layoutKind.explicit ... checked. In a certain sense, it is The Right Thing, but I ran out of fingers calculating FieldOffsetAttribute. layoutKind.sequential leads to easier maintenance, only have to check order and type, not order, type and offset. Does it have a particular advantage over sequential that I'm missing? I'll grow more fingers if it gives an advantage...
IIRC, SizeConst is useful against the entire struct when there is one terminal array, but this has at least three.
"simple string field": Non-Blittable.
"Fixed size byte array" would be absolutely lovely. IT has decided to try to upgrade to .NET 2.0 by the end of the year, and once they do that, byte arrays become useful, and more refactoring can begin. This is Most Broken Thing, after "specification written in C#". Implementation in C#, fine, specification in C#, not fine.
And most of my problems with it can be traced to it's starting life as .NET 1.0, with some parts have been upgraded to 1.1. Still experiencing the bugs of building on a release before the bug release... like no fixed size byte arrays in structs that meet the blittability requirements. |