Jil
Jil copied to clipboard
Fast decimal deserialization
The following links have some pretty amazingly fast decimal parsers: https://stackoverflow.com/a/37754822/298609 https://stackoverflow.com/a/8458496/298609
Which in my testing are significantly faster than the deserializer Jil is using. The linked deserializers do have some problems though, as they do not parse scientific notation, leading/trailing spaces, thousand separators, all those goodies. They are very useful for parsing financial data though, in a format like 345.69594
What I have in mind is something like this:
public class A
{
[JilDirective(DecimalParser = JilDecimalParsers.UnsignedPlainDecimal)]
public decimal Price
{ get; set; }
}
Where UnsignedPlainDecimal means I do not care about sign, thousand separators or anything, because all the numbers coming in are in the 345.69594 format (decimal separator optional though). This would allow existing code to use the feature-rich decimal.Parse, while you could explicitly opt in for a faster parser.