|
-
May 28th, 2008, 12:31 PM
#1
Help with optimization
This line:
Code:
L*neasDeArchivo = Split(sr.ReadToEnd(), vbCrLf)
in this code:
Code:
Dim L*neasDeArchivo() as String
fs = File.OpenRead(FilePath)
sr = New StreamReader(fs)
L*neasDeArchivo = Split(sr.ReadToEnd(), vbCrLf)
fs.Close()
takes too much time (63 seconds, because there are 2,000,000.0 lines to pass to L*neasDeArchivo() array).
¿somebody knows a faster way?
_
-
May 28th, 2008, 01:09 PM
#2
Re: Help with optimization
You could as well read one line at a time instead of reading the whole file. Imagine, what happens if the file is greater than 2 GB. I would never read the whole content of file unless I am 100% sure that the file is going to be small.
-
May 28th, 2008, 01:15 PM
#3
Re: Help with optimization
Also if the lines are independant, you can process each one using a worker thread....
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|