In my binary to text decoding application (.NET 2.0) I found that the line:
logEntryTime.ToString("dd.MM.yy HH:mm:ss:fff")
takes 33% of total processing time. Does anyone have any ideas on how to make it faster?
EDIT: This app is used to process some binary logs and it currently takes 15 hours to run. So 1/3 of this will be 5 hours.
EDIT: I am using NProf for profiling. App is processing around 17 GBytes of binary logs.
It’s unfortunate that .NET doesn’t have a sort of "formatter" type which can parse a pattern and remember it.
If you’re always using the same format, you might want to hand-craft a formatter to do exactly that. Something along the lines of:
This is pretty ugly, but it’s probably a lot more efficient… benchmark it, of course!