- What did you expect?
  Create an account
:: Home  ::  Downloads  ::  Your Account  ::  Forums  ::
Google Adsense
  • Home
  • Downloads
  • ExpectationReviews
  • Forums
  • Group29 FAQ
  • MovieReviews
  • OtherReviews
  • Stories Archive
  • Submit News
  • Top 10
  • Topics
  • Web Links
  • New at Group29
    ·Movie Review: Avengers: Infinity War [26]
    ·Movie Review: Incredibles 2 [25]
    ·2018 UCLA vs USC preview
    ·Expectation Review: Avengers: Infinity War [24]
    ·2017 USC vs UCLA preview
    ·Forum Topic: Update your Facebook property
    ·Expectation Review: Star Wars: The Force Awakens [29]
    ·Web Link: WEP Key Converter
    ·Forum Topic: Why does my IPA file get saved as a zip file in IE?
    ·Web Link: BeyondCompare

    ·Rebelscum Breast Cancer Awareness Charity Patch
    ·BBC Interviews J.J. Abrams About Trek And Wars
    ·CEII: Jabba's Palace Reunion - Massive Guest Announcements
    ·Fathead's May the Fourth Be With You!
    ·Star Wars Night With The Tampa Bay Storm Reminder
    ·Stephen Hayford Star Wars Weekends Exclusive Art
    ·ForceCast #251: To Spoil or Not to Spoil
    ·New Timothy Zahn Audio Books Coming
    ·SDCC: Exclusive Black Series Boba Fett With Han In Carbonite Set
    ·Star Wars Art Exposition May 4th

    Hot trends

    Group29 Discussion Board :: View topic - VisualBasic.NET speed string operations with StringBuilder
    Log in Register Forum FAQ Memberlist Search
    Ratings, Links, Free Speech and more

    Group29 Discussion Board Forum Index -> Group29 Tech Tips -> VisualBasic.NET speed string operations with StringBuilder
    Post new topic  Reply to topic View previous topic :: View next topic 
    VisualBasic.NET speed string operations with StringBuilder
    PostPosted: Tue May 17, 2005 11:13 am Reply with quote
    Joined: Jun 23, 2004
    Posts: 340


    I had a Visual Basic.NET ASP.NET application that was digesting a text input file 3 megabytes in size with 30,000 lines. It was taking 20 minutes to complete! I began looking at different factors. The actual upload went like this:

    fileMyFile.PostedFile.SaveAs(Server.MapPath(".") & TempCSVFilename)

    and it used a System.Web.UI.HtmlControls.HtmlInputFile control on the web page. It completed within one second. So I knew that was not the problem.

    It seemed that the Regex and Try/Catch statements were also not the problem. The real speed up came when I took out a String append step. I had a string called "Textboxstring" to which I kept appending message data. It would eventually reach about 40,000 lines. At the end, I would send this text data to the results web page.

    My savior was the Stringbuilder class! My original code was like this:

    Dim TextBoxString As String

    within the loop I had
    TextBoxString=TextBoxString & sampleText

    I replaced it with:
    Dim TextBoxString As New System.Text.StringBuilder



    This Excellent Article: Manipulate Strings Faster in VB.NET really helped me out.
    View user's profile Visit poster's website
    VisualBasic.NET speed string operations with StringBuilder
      Group29 Discussion Board Forum Index -> Group29 Tech Tips
    You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot vote in polls in this forum
    All times are GMT - 6 Hours  
    Page 1 of 1  

     Post new topic  Reply to topic  

    Powered by phpBB © 2001-2003 phpBB Group
    Theme created by Vjacheslav Trushkin
    Forums ©
    Group29 Productions

    All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest (c) 2006 by Group29 Productions.

    You can syndicate Group29 Productions news with an RSS Feeder using the file backend.php

    PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
    Page Generation: 0.21 Seconds

    :: HeliusGray phpbb2 style by CyberAlien :: PHP-Nuke theme by ::