My test post

databases United States
  • 19 years ago

    test

  • 19 years ago

    The below code/timing is on a 270-mb text file (over 460,000 lines).  Why would the ADO ADODB Stream Object get progressively slower as it steps through the stream?  How can I speed it up as I traverse?
    Thanks.


    Running Win2K-SP1, MDAC2.5, MDAC2.6-SP1, MSXML3-SP1, WSH5.6 (Sept official release)



    oStream = WScript.CreateObject("ADODB.Stream")
    With oStream
     .Mode = 8                ' adModeShareDenyWrite
     .Type = 2                ' adTypeText
     .CharSet = "ascii"        ' default is Unicode
     .LineSeparator = -1        ' adCRLF
     .Open
     .LoadFromFile "newsirtestbig.txt"
    End With
    tStartTime = Now
    WScript.Echo "Begin traverse: " & tStartTime
    oStream.Position = 0
    iLineCounter = 1
    Do While Not oStream.EOS
     cTempLine = oStream.ReadText(600)
     iLineCounter = iLineCounter + 1
     If iLineCounter MOD 10000 = 0 Then
     WScript.Echo Now & ":  Currently processing row " & iLineCounter
     End If
     oStream.SkipLine
    Loop
    tEndTime = Now
    WScript.Echo "End traverse" & tStartTime
    WScript.Echo "Total time (seconds): " & DateDiff("s" , tStartTime , tEndTime)
    WScript.Echo vbCRLF




    Begin traverse: 9/25/2001 2:55:41 PM
    9/25/2001 2:55:44 PM:  Currently processing row 10000
    9/25/2001 2:55:46 PM:  Currently processing row 20000
    9/25/2001 2:55:49 PM:  Currently processing row 30000
    9/25/2001 2:55:53 PM:  Currently processing row 40000
    9/25/2001 2:55:56 PM:  Currently processing row 50000
    9/25/2001 2:56:01 PM:  Currently processing row 60000
    9/25/2001 2:56:06 PM:  Currently processing row 70000
    9/25/2001 2:56:13 PM:  Currently processing row 80000
    9/25/2001 2:56:21 PM:  Currently processing row 90000
    9/25/2001 2:56:30 PM:  Currently processing row 100000
    9/25/2001 2:56:40 PM:  Currently processing row 110000
    9/25/2001 2:56:50 PM:  Currently processing row 120000
    9/25/2001 2:57:02 PM:  Currently processing row 130000
    9/25/2001 2:57:15 PM:  Currently processing row 140000
    9/25/2001 2:57:29 PM:  Currently processing row 150000
    9/25/2001 2:57:43 PM:  Currently processing row 160000
    9/25/2001 2:57:59 PM:  Currently processing row 170000
    9/25/2001 2:58:17 PM:  Currently processing row 180000
    9/25/2001 2:58:34 PM:  Currently processing row 190000
    9/25/2001 2:58:52 PM:  Currently processing row 200000
    9/25/2001 2:59:11 PM:  Currently processing row 210000
    9/25/2001 2:59:30 PM:  Currently processing row 220000
    9/25/2001 2:59:50 PM:  Currently processing row 230000
    9/25/2001 3:00:13 PM:  Currently processing row 240000
    9/25/2001 3:00:37 PM:  Currently processing row 250000
    9/25/2001 3:01:02 PM:  Currently processing row 260000
    9/25/2001 3:01:28 PM:  Currently processing row 270000
    9/25/2001 3:01:54 PM:  Currently processing row 280000
    9/25/2001 3:02:20 PM:  Currently processing row 290000
    9/25/2001 3:02:48 PM:  Currently processing row 300000
    9/25/2001 3:03:14 PM:  Currently processing row 310000
    9/25/2001 3:03:42 PM:  Currently processing row 320000
    9/25/2001 3:04:10 PM:  Currently processing row 330000
    9/25/2001 3:04:39 PM:  Currently processing row 340000
    9/25/2001 3:05:12 PM:  Currently processing row 350000
    9/25/2001 3:05:45 PM:  Currently processing row 360000
    9/25/2001 3:06:19 PM:  Currently processing row 370000
    9/25/2001 3:06:52 PM:  Currently processing row 380000
    9/25/2001 3:07:26 PM:  Currently processing row 390000
    9/25/2001 3:08:03 PM:  Currently processing row 400000
    9/25/2001 3:08:39 PM:  Currently processing row 410000
    9/25/2001 3:09:15 PM:  Currently processing row 420000
    9/25/2001 3:09:51 PM:  Currently processing row 430000
    9/25/2001 3:10:27 PM:  Currently processing row 440000
    9/25/2001 3:11:06 PM:  Currently processing row 450000
    9/25/2001 3:11:46 PM:  Currently processing row 460000
    End traverse: 9/25/2001 2:55:41 PM
    Total time (seconds): 980

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.” - Rick Osborne