Hello guys,
I have just posted both the entire subroutine involved in the extraction and the first 100 rows of the text file. Please keep in mind that this file has 5 columns and almost 4230000 rows (112Mb) ... The size is a very important detail as long as we should avoid some aproaches which take time.
As you can see, I have kept an usual timer to make different trials worked around comparable. In my PC the below process took almost 12 seconds and I would consider this time as a reference.
Again, is something redundant in my aproach (in terms of time or coding) ? Maybe I could avoid, in a way, to load those three unuseful columns in myArray...Is there any other feasible aproach to work with a huge database like this? I have some doubts that using an ADO I could improve my process but I will try tommorow. At least if we take into account that my goal is to find some substrings in that huge string...Code:'Load using the Input # statement (Fastest Method) Private Sub btnInput_Click() Dim fnum As Integer, i As Long Dim myArray() As String, bigArray() As String Dim start_time As Single, stop_time As Single Dim pathFile As String, bigJoin As String pathFile = App.Path & "\hugeFile.txt" Screen.MousePointer = vbHourglass DoEvents 'ReDim's should be done in run time but this takes time.... ReDim myArray(1 To 5, 6000000) ReDim bigArray(6000000) fnum = FreeFile start_time = Timer Open pathFile For Input As #fnum i = 0 Do While Not EOF(fnum) 'Check for end of file Input #fnum, myArray(1, i), myArray(2, i), myArray(3, i), myArray(4, i), myArray(5, i) i = i + 1 Loop Close #fnum ReDim Preserve myArray(1 To 5, i) ReDim bigArray(1 To UBound(myArray, 2)) 'We keep only the first and the fourth column For i = 1 To UBound(myArray, 2) bigArray(i) = myArray(1, i) & " " & myArray(4, i) & " " Next i bigJoin = Join(bigArray) stop_time = Timer Label1.Caption = Format$(stop_time - start_time, "0.00") & " sec." Screen.MousePointer = vbDefault End Sub
Thank you all for your support.




Reply With Quote