Open GoogleCodeExporter opened 9 years ago
Not able to reproduce this myself, output is fast just like Win32/x64 CL
compilation for me.
I'll happily integrate a patch if you are able to identify and fix the cause
yourself.
Original comment by gavin.dj.pugh
on 29 Oct 2014 at 9:21
Hi,
By debugging the dll (in MSBuild.exe) I found that the 4th RegEx at Util.cs was
running very slow for me.
So, I have done a change to evaluate and do the replacement of the 4th Regex by
a function (which I cannot say if it is very correctly because I did not
understand very well the RegEx's) (Code at the end).
After doing that, the build was really faster for many logging points.
private static Regex[] REGEX_GCC_REGEX_MATCH = new Regex[4];
public static bool do4(ref string lineRetParam, string line)
{
int i = 0;
string lineRet;
while (i < line.Length && System.Char.IsWhiteSpace(line[i]))
{
i++;
}
if (i >= line.Length)
return false;
int i1 = i;
while (i < line.Length && line[i] != ':')
{
i++;
}
if (i >= line.Length)
return false;
int i2 = i;
while (i < line.Length && line[i] != ':')
{
i++;
}
if (i >= line.Length)
return false;
int i3 = i;
if (i < line.Length && (!System.Char.IsDigit(line[i]) || line[i] == '0'))
return false;
while (i < line.Length && line[i] != ':')
{
if (!System.Char.IsDigit(line[i]))
return false;
i++;
}
if (i >= line.Length)
return false;
int i4 = i;
string filename = line.Substring(i2, i3 - i1);
string absPath = Path.GetFullPath(filename);
lineRet = absPath + "(" + line.Substring(i3, i4 - i3) + "): " + "'" + line.Substring(i1, i2 -i1) + "'" + line.Substring(i4);
lineRetParam = lineRet;
return true;
}
public static string GCCOutputReplace(string line)
{
// Replaces given GCC style output, with output that obeys Visual Studio's 'jump to line' formatting. So:
// CppSource/demo.c:51: error: conflicting types for 'seedRandom'
// becomes:
// c:\Projects\san-angeles\CppSource\demo.c(51) error: conflicting types for 'seedRandom'
for (int i = 0; i < GCC_REGEX_MATCH.Length; i++)
{
// Do we match this...?
if(i == 3)
{
if(do4(ref line, line))
return line;
continue;
}
Regex regEx = REGEX_GCC_REGEX_MATCH[i];
if(REGEX_GCC_REGEX_MATCH[i] == null)
{
REGEX_GCC_REGEX_MATCH[i] = new Regex(GCC_REGEX_MATCH[i]);
regEx = REGEX_GCC_REGEX_MATCH[i];
}
if (regEx.IsMatch(line))
{
// Good, we do. For now just grab the filename portion
string filename = regEx.Replace(line, GCC_REGEX_FILENAME[i]);
try
{
// Brackets cause issues:
// C:\Projects\vs-android\vs-android_samples\san-angeles\CppSource\cams.h(49) error; (near initialization for 'sCamTracks[0]')
// So I'll remove them first
//line = line.Replace("(", "");
//line = line.Replace(")", "");
// Attempt to convert to a fullpath. We'll drop out of this regex attempt if it fails, it'll throw an Exception.
string absPath = Path.GetFullPath(filename);
// All good then. Just do the final regex replace, appended after the resolved filename.
string lastBit = regEx.Replace(line, GCC_REGEX_REPLACE[i]);
string newLine = absPath + lastBit;
return newLine;
}
catch
{
continue;
}
}
}
return line;
}
}
Original comment by camil...@gmail.com
on 4 Nov 2014 at 9:45
Original issue reported on code.google.com by
camil...@gmail.com
on 23 Sep 2014 at 8:32