Bug on big tasks

  • ThzChz

    ThzChz - 2007-12-15

    I don't know why, but I noticed why I ask the script some big tasks it fails on some.

    For example I ran a 25 lines script on a 4000 line file, with only "replace" and "replacecase", and I have like 10 lines which are ignored by my script.

    Any clue ?

    • fidvo

      fidvo - 2007-12-17

      I'll look into that.

      The built-in StringReplace function in Delphi isn't very scalable; on large strings it runs very slowly.  Since I wanted line breaks to be available in the search and replace strings, I couldn't just run the StringReplace on individual lines.  So I wrote a function to break the file into manageable chunks and run it on them individually, then concatenate them together.  That's the most likely place where the problem is occurring.

      A few questions:

      Are the ignored lines in the beginning, end, or middle of the file?

      Do some of the replaces work and not others?

      Could you copy and paste your script into this forum?  Maybe there's something in them that I hadn't anticipated when coding it.

    • ThzChz

      ThzChz - 2007-12-21

      I'm not sure if it's random or not, I've been able to reproduce this on the same lines but not each time. It's in the middle of the file.

      Try this:

      on this file:

      Line 1904 and 4368, ignored on a first pass, taken in on the 2th. I'm aware that some line are ignored due to the return type (332 for instance), but in that case a second pass shouldn't fix it.

      Good luck !


Log in to post a comment.