Re: Text Files or binaries with objects?
- From: erewhon@xxxxxxxxxx (J French)
- Date: Mon, 6 Mar 2006 10:34:30 +0000 (UTC)
On Mon, 6 Mar 2006 08:30:39 +0000 (UTC), "peave" <me@xxxxx> wrote:
Hi.
I have some large text files that I need to repeatedly analyse. I can easily
parse the strings and load the data into my custom object ready to be
analysed, but the parsing has to take time, and I have a large number of
these text files to analyse.
Wouldn't it be more efficient, given that I will be re-analysing each text
file many times over many sessions, to parse the text files once, then save
my list of objects as a binary file, effectively avoiding the need to
repeatedly parse strings? I imagine it would, but I'm not sure how to do it.
At the moment I am using a TStringList to store the custom objects, but it
appears the SaveToFile method only saves the strings, not the objects
associated with them. If I use some SaveToStream cose, how do I decode the
stream when it come back?
The objects I use are really just records at the moment, with several
properties of type 'Single', and one 'TDateTime' property. I have used an
object type just in case I need to add methods etc that I haven't
anticipated.
Perhaps I'm giving you bad advice, but my instinct here is to avoid
complexity.
If you reformat each line of your data so it looks like this as text:-
The text line is here | 31-12-2006, 1234, 1.76, 999 #13#10
Then you can load/save the data as a TStringList
The extra 'parsing' would be pretty insignificant, and you would not
'lose sight' of your data.
.
- References:
- Text Files or binaries with objects?
- From: peave
- Text Files or binaries with objects?
- Prev by Date: Re: Why wont this work ?
- Next by Date: Re: JvHidControllerClass.pas(508): Incompatible types: 'Integer' and 'Pointer'
- Previous by thread: Text Files or binaries with objects?
- Next by thread: Re: Text Files or binaries with objects?
- Index(es):
Relevant Pages
|