No announcement yet.

Strange Problem????

  • Filter
  • Time
  • Show
Clear All
new posts

  • Strange Problem????

    I have been pulling my hair out on this one, but have narrowed it down. I was writing a large stream of data to a binary file under Windows Vista 64 with Trend Micro Internet Security virus suite and noticed unusually long delays in my code at times. I started placing MsgBox's in various parts of the code so that I knew where it was and found it to be the Close statement that was taking a long time. BUT: only when hyphens were present in large number in the written data stream. Does this make sense? Why should the data stream matter?

    Here's a test snippet:
    #Compile Exe
    #Dim All
    Function PBMain
       Local idx As Dword
       Local blob As String
       Local tt As Double
       ? "Begin Build"
    '   blob = Repeat$(20971520, "Repeated-String-")   ' Build 320 MB String   This string takes 27 seconds
       blob = Repeat$(20971520, "Repeated String ")   ' Build 320 MB String   This string takes 5.5 seconds
       ? "End Build: Len = " & Format$(Len(blob)),,"Len(blob)"
       ? "begin write file"
       tt = Timer
       Open "blob.dat" For Binary As 1
       Put$ 1, blob
       Close 1
       ? "done in " & Format$(Timer-tt, "0.000") & " seconds."
       Kill "blob.dat"
    End Function
    If I build and write the string with hyphens it takes roughly 27 seconds for the file operation to complete (most of the time on the Close statement). If I build and write the string with spaces instead, it only takes 5.5 seconds for the same block of code to run.

    I haven't tested this on other machines yet, but intend to. If you have a chance give it a shot on yours. I tried the code above with both PBWin8 and PBWin9 with the same results. I am guessing it may be the virus scanner, but have not made that conclusion just yet. I figured I'd let a few others see if they had similar results.

    If you run this please show times for hyphens vs. spaces and your OS and virus software (if any).

    Scott Slater
    Summit Computer Networks, Inc.

  • #2
    I've never known it to be data-dependent, but the PB "CLOSE" is translated into CloseHandle(), which is one of those functions Windows regards as "low priority" and it does not get done immediately; that is, delays on CLOSE/CloseHandle() are not something new.

    For it to be data-dependent, though, I think you almost have no options other than looking at 'other processes with an interest in new files.'

    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]


    • #3
      It seems that it is indeed the anti-virus software doing this. It must examine I/O streams and something with the hyphens causes it to take a much longer time than without.
      Scott Slater
      Summit Computer Networks, Inc.


      • #4
        I just tried it Scott and had the same experience as you. Also have Trend Micro installed (Which I have found WAY better than any other anti-virii checkers).

        Times are 5.61 & 50.19 secs with 'PBWIN 9.01 - WinApi 05/2008 - XP Pro SP3.

        I'll be curious to see if others with different Virus Checkers have the same experience.

        "Success has a thousand fathers,
        And defeat is an orphan."
        It's a pretty day. I hope you enjoy it.


        JWAM: (Quit Smoking):
        LDN - A Miracle Drug:


        • #5
          PBwin 9.01, WinApi 05/2008, Vista 64, Avast Home 4.8

          hyphens 7.681 secs

          spaces 7.702 secs



          • #6
            PBWin 9.01; XP3, AMD64 3800+;2.42GHz;3Gb RAM, AVG/Ad-aware/Zone Alarm

            Spaces = 4.407 secs
            Hyphens = 4.391 secs (????)

            Checked (repeatedly!)

            Iain Johnstone
            “None but those who have experienced them can conceive of the enticements of science” - Mary Shelley


            • #7
              Using ms live one,
              no hyphens - 4.094
              hyphens 3.844


              • #8
                At odd times, I find certain keys don't work (Delete/Backspace, C&P functions, ??) when in the forum editor. I've always thought it was a forum editor quirk of some kind, but now I bet it's Trend Micro. Bummer, but even with shortcomings it's still worth it for me. Of course I haven't had such serious slowdown experriences like Scott has.

                "I don't feel good."
                The last words of Luther Burbank (1849-1926)
                It's a pretty day. I hope you enjoy it.


                JWAM: (Quit Smoking):
                LDN - A Miracle Drug:


                • #9
                  McAfee 8.5.0i
                  5301.4018 Scan engine
                  5653.0000 Dat version

                  Windows XP SP3 3.4ghz 4gb Ram Dell Optiplex GX620

                  PB/CC 5.01

                  Spaces: 7.100
                  Hyphens: 7.711
                  <b>George W. Bleck</b>
                  <img src=''>