473,396 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Text Files and arrays

Hi all....
I need to work with large text files....i know there is a lot of ways under
net to work with them....
i want speed, High Percentage of correctness

so i was thinking ...but not sure the best way to handle text files for
parsing into reports, or into SqlDatabase
or Where Ever else

my question is;
I can build a class which i did under win32 low level file io that only
stores the line offsets in a Array, which is quit fast i was able to load a
million plus line file in less than 6 seconds , so most files that are only
in the megabytes were a blink of a eye. then the class wrapper moves
pointers (not the data on disk) i only accessed disk when data was required,
worked pretty good.

under net i can load the whole file into a single dim array
i can calculate the array dim prior to load so there are only 2 sizing , the
creation of the array and at the end of load, sizing down to what i actually
used...

which is the best way to handle the files in .NET
Just load the The Array/collection with the rows in the file
or
Just load the line offsets into a array and process rows as required

Tks MJ
Jul 18 '07 #1
2 1845
I would go with offsets.

Do you expect files greater than 1Gb?

"MikeJ" <ve***********@sbcglobal.netwrote in message
news:vk*******************@newssvr14.news.prodigy. net...
Hi all....
I need to work with large text files....i know there is a lot of ways
under net to work with them....
i want speed, High Percentage of correctness

so i was thinking ...but not sure the best way to handle text files for
parsing into reports, or into SqlDatabase
or Where Ever else

my question is;
I can build a class which i did under win32 low level file io that only
stores the line offsets in a Array, which is quit fast i was able to load
a million plus line file in less than 6 seconds , so most files that are
only in the megabytes were a blink of a eye. then the class wrapper moves
pointers (not the data on disk) i only accessed disk when data was
required, worked pretty good.

under net i can load the whole file into a single dim array
i can calculate the array dim prior to load so there are only 2 sizing ,
the creation of the array and at the end of load, sizing down to what i
actually used...

which is the best way to handle the files in .NET
Just load the The Array/collection with the rows in the file
or
Just load the line offsets into a array and process rows as required

Tks MJ


Jul 18 '07 #2
yes i do expect files greater than 1g....not often but will happen from time
to time....
im finishing the class that does offsets...and my current
testiing...1.1million rows 147meg takes about 7
seconds to load the offsets, which include
end of line crlf pair, cronly only and mixture of crlf and lf markers
i just go throw the file once....
i create the long[] with a size larger than required
estimated linelength/6
subtract the remainder from estimated length devide that by filesize puts me
a few elements over and above elements needed to load the file and traverse
it once.
Still working on the math above to get the array size closer to what is
needed.
so there is only 2 Array sizing...1=Creation 2=resize to ending size
(actually loaded offsets).
thanks for you advice
MJ

"AlexS" <sa***********@SPAMrogers.comPLEASEwrote in message
news:On**************@TK2MSFTNGP02.phx.gbl...
>I would go with offsets.

Do you expect files greater than 1Gb?

"MikeJ" <ve***********@sbcglobal.netwrote in message
news:vk*******************@newssvr14.news.prodigy. net...
>Hi all....
I need to work with large text files....i know there is a lot of ways
under net to work with them....
i want speed, High Percentage of correctness

so i was thinking ...but not sure the best way to handle text files for
parsing into reports, or into SqlDatabase
or Where Ever else

my question is;
I can build a class which i did under win32 low level file io that only
stores the line offsets in a Array, which is quit fast i was able to load
a million plus line file in less than 6 seconds , so most files that are
only in the megabytes were a blink of a eye. then the class wrapper
moves pointers (not the data on disk) i only accessed disk when data was
required, worked pretty good.

under net i can load the whole file into a single dim array
i can calculate the array dim prior to load so there are only 2 sizing ,
the creation of the array and at the end of load, sizing down to what i
actually used...

which is the best way to handle the files in .NET
Just load the The Array/collection with the rows in the file
or
Just load the line offsets into a array and process rows as required

Tks MJ



Jul 18 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jaunty Edward | last post by:
Hi, My problem is a little advance I feel, please check it and guide me if you can. I have a lot of similar format text files, that has name in the first line then age in forth line second and...
18
by: xarax | last post by:
Greetings, What is the general practice, usual and customary way, of including a data file into a source file? I have some large data structures defined as source similar to: ...
2
by: David | last post by:
Hi all, I am fairly new to C#. so go easy on me :-) Anyhow, I have a class file that I have set up properties and a method. I am calling this class file directly from and aspx.cs file. So...
3
by: Charles E. Vopicka | last post by:
i think i already know the answer to the first question but it took me 2 months of searching to find it. i am writing a program that collects user input then stores the data in arrays then when...
6
by: Adrian Lin | last post by:
Is there a way to read a specfic line in a text file? For instance if I wanted to just read the 5th line is that possible without having to step through the other lines? Essentially I am doing huge...
1
by: cabral | last post by:
hello, i have a program that has 2 arrays but the info to be used in the array is in 2 text files... i want to know how to call the text files. please and thankyou
6
by: sjaco | last post by:
i need an application that output a list of data to a text file. i have it set to save all of the data into arrays but it will not output the arrays to a .txt file. All i get is 0x22fed0 in the txt....
0
by: JosAH | last post by:
Greetings, Introduction Before we start designing and implementing our text builder class(es), I'd like to mention a reply by Prometheuzz: he had a Dutch version of the entire bible ...
10
by: Tammy | last post by:
Hello all, I am wondering what is the best way to declare a struct to be used in other c and c++ files. Such as for a C API that will be used by others. 1. Declaring the typedef and the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.