Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8214663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:31:53+00:00 2026-06-07T11:31:53+00:00

I’m reading from 1-5mb log files outputting to a textview and also searching for

  • 0

I’m reading from 1-5mb log files outputting to a textview and also searching for specific lines outputting to another textview. Currently it takes about a minute for just a 1mb file. Does anyone know any faster methods of searching through lines or strings other than the method I’m using?

Imports EnterpriseDT.Net.Ftp

Public Class Form1

Private Sub SettingsToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles SettingsToolStripMenuItem.Click

End Sub

Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
    Dim sw As New Stopwatch
    Dim FullLine As String = ""
    Dim ScriptLine As String = ""
    sw.Start()

    Dim ll As New Queue(Of String)

    Dim i As String = ""

    Using TestFile As New IO.StreamReader("c:\test.txt", System.Text.Encoding.Default, False, 4096)

        Using OutFile As New IO.StreamWriter("c:\SBOutFile.txt", False, System.Text.Encoding.Default, 4096)

            While TestFile.EndOfStream = False

                i = TestFile.ReadLine

                If i.Contains(".sqf") And i.Contains("handleGear.sqf") = False Then
                    ScriptLine = ScriptLine & i & vbNewLine & vbNewLine
                    FullLine = FullLine & i & vbNewLine & vbNewLine
                Else
                    FullLine = FullLine & i & vbNewLine & vbNewLine
                End If

            End While

        End Using

    End Using

    sw.Stop()
    TextBox1.Text = FullLine
    TextBox2.Text = ScriptLine
    RichTextBox1.AppendText(String.Format("Run_Queue took {0} Milliseconds." & Environment.NewLine, sw.ElapsedMilliseconds))
End Sub

Private Sub Button1_Click_1(sender As System.Object, e As System.EventArgs) Handles Button1.Click
    Try
        'connect to ftp server
        Dim ftp As New FTPConnection
        ftp.ServerAddress = "-"
        ftp.ServerPort = "-"
        ftp.UserName = "-"
        ftp.Password = "-"
        ftp.Connect()
        ftp.ChangeWorkingDirectory("-")
        ftp.TransferType = FTPTransferType.BINARY

        'download a file
        ftp.DownloadFile("c:\test.txt", "scripts.log")

        'ftp.RenameFile("scripts.log", "scripts_test.log")

        'close the connection
        ftp.Close()

    Catch ex As Exception
        MessageBox.Show(ex.Message.ToString())
    End Try
End Sub

Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click

End Sub

End Class

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T11:31:55+00:00Added an answer on June 7, 2026 at 11:31 am

    Given the heavy reading and concatenating you are doing as you’re reading, I suspect its part of your time/performance issue. I would probably consider changing the declarations for ScriptLine and FullLine from String type to a StringBuilder, because Strings are technically immutable. That means each concatenation really turns out to be teardown of the previous object, and the creation of a new one in its place. StringBuilders are designed specifically for heavy concatenation scenarios. When the looping is finished, you can convert it back to a String.

    Also, a compiled Regular Expression might search faster than String.Contains. Your regular expression string would be something like “(?!handleGear).sqf”, meaning “find any sequence of zero or more characters other than “handleGear” in front of the string “.sqf”.

    I haven’t had a chance to test that expression, so it is offered with that caveat. If I get a chance to throw together a test, I’ll be glad to amend and let you know.

    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently running into a problem where an element is coming back from
I have a bunch of posts stored in text files formatted in yaml/textile (from
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.