How to parse huge file with timestamps
I need to parse a text file where each line is timestamped.
Each line has the form "timestamp, value1, value2"
I have to get max value of value1 between two timestamps and the the
avg value of value2 between another two timestamps. What would be an
efficient way to do this in terms of memory and processing time?
What comes to mind now is to read each line and store values in a
vector of objects. Then traverse that vector later to find the starting
timestamp and ending timestamp and process data in between. But it
doesn't sound like the most efficient way given that the files are huge.
Re: How to parse huge file with timestamps
On 30 Nov 2005 14:04:10 -0800, firstname.lastname@example.org wrote, quoted or
indirectly quoted someone who said :
> I have to get max value of value1 between two timestamps and the the
>avg value of value2 between another two timestamps. What would be an
>efficient way to do this in terms of memory and processing time?
you process the file sequentially, convert your timestamps to longs,
subtract and keep the longest value you find in variable called
if (diff > longest ) longest = diff;
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
|All times are GMT. The time now is 10:28 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.