I take no responsibility for these ideas. They are probably all completely insane and you shouldn't use them.
System.Text.RegularExpressions.Match is a pretty decent record type I was writing an app that read log files. I created a LogLine class that encapsulated each line from a log file, contained a RegEx to parse it with and a bunch of properties to store all the parsed components. Was using too much memory, so I started optimizing:
- first optimization was to throw away the private string fields holding the parsed components of the line and just re-parse the line each time with a memoized Match object,
- second optimization was to throw away the original string containing the the line and just use
Match.Value ,
- third optimization was to convert LogLine into a static class and simply store the Match object in the host's collections instead.
This was insane, I was now using Match as a record type.
|
|