2

Closed

Remove Lines take 10 minutes to execute

description

I have a 1.3 MB SQL file that I am using the RemoveLines task to remove 5 lines of text from the file. For some reason this is taking upwards of 8 minutes. What can I do to figure out why it's taking so long?
    <ItemGroup>
      <!-- schema file-->
      <FilesToParse Condition="'$(FileToParse)'!=''" Include="$(FileToParse)"/>
      <FilesToParse Condition="'@(FilesToParse)'==''" Include="$(CVToolsOutputDir)\CV Schema\*.sql"/>

      <!-- Lines to remove-->
      <LinesToRemove Include=":setvar DatabaseName "Blackbaud.CustomFx.CV.Staging.Schema""/>
      <LinesToRemove Include=":setvar DefaultFilePrefix "Blackbaud.CustomFx.CV.Staging.Schema""/>
      <LinesToRemove Include=":setvar DefaultDataPath """/>
      <LinesToRemove Include=":setvar DefaultLogPath """/>
      <LinesToRemove Include=":on error exit"/>
    </ItemGroup>

    <Message Text="$(FileToParse)" />
    
    <!-- Remove lines from a file based on regular expressions -->
    <MSBuild.ExtensionPack.FileSystem.File TaskAction="RemoveLines"
                                           Files="@(FilesToParse)"
                                           Lines="@(LinesToRemove)"/>

Closed Feb 16, 2014 at 3:12 PM by mikeFourie

comments

mikeFourie wrote Jan 18, 2014 at 8:59 AM

investigating a way to speed this up for files with a large # of lines. will try get into feb release.

mike

wrote Feb 16, 2014 at 2:46 PM

Associated with changeset 87293: FileSystem\File.cs: Add AvoidRegex and MatchWholeLine to address perf issue

mikeFourie wrote Feb 16, 2014 at 3:12 PM

Can you try the latest code using

<MSBuild.ExtensionPack.FileSystem.File TaskAction="RemoveLines"
                                       Files="@(FilesToParse)" __AvoidRegex="true"__
                                       Lines="@(LinesToRemove)"/>
It should complete in under a second or so.

Mike

wrote Feb 16, 2014 at 3:12 PM

djjay0131 wrote May 2, 2014 at 1:11 PM

Hi,

Where do I get the latest code? I'm getting the DLL using nuget in my projects right now, do I need to pull down the raw code?

Thanks,
Jason

mikeFourie wrote May 2, 2014 at 2:14 PM