Results 1 to 5 of 5

Thread: StreamReader to slow?!?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    top of the mountain
    Posts
    234

    Question StreamReader to slow?!?

    Hi,
    I get some web page in this way:

    VB Code:
    1. Dim txt as string
    2. Dim startD As Date, endD As Date
    3. Dim rS As Stream
    4.     rS = HttpWebResponse.GetResponseStream()
    5.     startD = DateTime.Now
    6.     Dim sR As New StreamReader(rS)
    7.     txt = strReader.ReadToEnd()
    8.     endD = Now

    This web page has about 350kb and difference from startD and endD is 8sec. I think that is to much time for loading 350kb file. Can I do it faster?

    thanks j

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: StreamReader to slow?!?

    I don't think it's the StreamReader but rather the tranfer rate/bandwidth/speed of the connection.

  3. #3
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: StreamReader to slow?!?

    You don't want to read documents that way, use BufferedStream instead because the ReadToEnd loads the entire stream in memory at once ( which might not work for larger WebStream, especially on client computer )
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    top of the mountain
    Posts
    234

    Re: StreamReader to slow?!?

    Thanks 'ComputerJy', I'll try with BufferedStream and post results here.

    stanav said:
    I don't think it's the StreamReader but rather the tranfer rate/bandwidth/speed of the connection.
    I don't think so, I write some stuff in vb6 using xmlHttp and I get web page text in 2-3sec.

    thanks j

  5. #5
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: StreamReader to slow?!?

    Why dont you put start and end times before and after the httpwebresponse, and then another set before and after the streamreader part, and compare the two to see what is the larger bottleneck. Is that all the code? Or are you doing more that you didn't post? Something with analyzing that data? Or are you merely displaying it...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width