PDA

View Full Version : دلیل کاهش سرعت



aleas2
شنبه 27 اردیبهشت 1393, 12:13 عصر
سلام خسته نباشید کد زیر برسی کنین ببینین چه چیزی باعث کاهش سرعت! میشه و راه حل چی؟

Dim out As String
Dim Regx As New RegExp

Regx.IgnoreCase = True
Regx.MultiLine = True

Open "c:/100.txt" For Input As #1
out = Input(LOF(1), #1)
Close #1
text1.Text = out

text2.Text = ""
Regx.Pattern = "http://test2.ir/n/(.*?)"">"

Set Machs = Regx.Execute(text1.Text)

Do While Regx.Test(text1) = True

Set Machs = Regx.Execute(text1.Text)

For Each Mach In Machs

a = Left(Mach.Value, Len(Mach.Value) - 2)
j = InStr(1, a, "test2.ir/n/")
j = InStr(j + 11, a, "/")
a = Left(a, j)

If InStr(1, text2.Text, a) = 0 Then '''''''''''

text2.Text = a & vbCrLf & text2.Text
txt_count = Val(txt_count.Text) + 1
txt_count2.Text = Val(txt_count2.Text) + 1

End If ''''''''''

text1.Text = Regx.Replace(text1.Text, "")
Next

DoEvents '''''

Loop

'''''''''''''''''''''''''''''
'''''''''''''''''''

نکته: سایز فایل c:/100.txt
20 مگابایت است