diff options
| author | Rob Mensching <rob@firegiant.com> | 2020-07-10 23:41:25 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2020-07-14 10:53:45 -0700 |
| commit | f4b7d3f7c0a49e70fe5d25a309387786589488a6 (patch) | |
| tree | 74162de1ece12ecd88c7c429f8f0ed155ca6b653 /src/WixToolset.Core/CompilerCore.cs | |
| parent | 28f41d1afec40d79459402fbed21f6c237768adb (diff) | |
| download | wix-f4b7d3f7c0a49e70fe5d25a309387786589488a6.tar.gz wix-f4b7d3f7c0a49e70fe5d25a309387786589488a6.tar.bz2 wix-f4b7d3f7c0a49e70fe5d25a309387786589488a6.zip | |
Major performance improvements to inline directory syntax parsing
Diffstat (limited to 'src/WixToolset.Core/CompilerCore.cs')
| -rw-r--r-- | src/WixToolset.Core/CompilerCore.cs | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/src/WixToolset.Core/CompilerCore.cs b/src/WixToolset.Core/CompilerCore.cs index d88858ae..e2c1a3d6 100644 --- a/src/WixToolset.Core/CompilerCore.cs +++ b/src/WixToolset.Core/CompilerCore.cs | |||
| @@ -120,7 +120,7 @@ namespace WixToolset.Core | |||
| 120 | private readonly IParseHelper parseHelper; | 120 | private readonly IParseHelper parseHelper; |
| 121 | private readonly Intermediate intermediate; | 121 | private readonly Intermediate intermediate; |
| 122 | private readonly IMessaging messaging; | 122 | private readonly IMessaging messaging; |
| 123 | private HashSet<string> activeSectionInlinedDirectoryIds; | 123 | private Dictionary<string, string> activeSectionCachedInlinedDirectoryIds; |
| 124 | private HashSet<string> activeSectionSimpleReferences; | 124 | private HashSet<string> activeSectionSimpleReferences; |
| 125 | 125 | ||
| 126 | /// <summary> | 126 | /// <summary> |
| @@ -354,12 +354,13 @@ namespace WixToolset.Core | |||
| 354 | /// Creates directories using the inline directory syntax. | 354 | /// Creates directories using the inline directory syntax. |
| 355 | /// </summary> | 355 | /// </summary> |
| 356 | /// <param name="sourceLineNumbers">Source line information.</param> | 356 | /// <param name="sourceLineNumbers">Source line information.</param> |
| 357 | /// <param name="attribute">The attribute to parse.</param> | 357 | /// <param name="attribute">Attribute containing the inline syntax.</param> |
| 358 | /// <param name="parentId">Optional identifier of parent directory.</param> | 358 | /// <param name="parentId">Optional identifier of parent directory.</param> |
| 359 | /// <param name="inlineSyntax">Optional inline syntax to override attribute's value.</param> | ||
| 359 | /// <returns>Identifier of the leaf directory created.</returns> | 360 | /// <returns>Identifier of the leaf directory created.</returns> |
| 360 | public string CreateDirectoryReferenceFromInlineSyntax(SourceLineNumber sourceLineNumbers, XAttribute attribute, string parentId) | 361 | public string CreateDirectoryReferenceFromInlineSyntax(SourceLineNumber sourceLineNumbers, XAttribute attribute, string parentId, string inlineSyntax = null) |
| 361 | { | 362 | { |
| 362 | return this.parseHelper.CreateDirectoryReferenceFromInlineSyntax(this.ActiveSection, sourceLineNumbers, parentId, attribute, this.activeSectionInlinedDirectoryIds); | 363 | return this.parseHelper.CreateDirectoryReferenceFromInlineSyntax(this.ActiveSection, sourceLineNumbers, attribute, parentId, inlineSyntax, this.activeSectionCachedInlinedDirectoryIds); |
| 363 | } | 364 | } |
| 364 | 365 | ||
| 365 | /// <summary> | 366 | /// <summary> |
| @@ -1001,6 +1002,16 @@ namespace WixToolset.Core | |||
| 1001 | } | 1002 | } |
| 1002 | 1003 | ||
| 1003 | /// <summary> | 1004 | /// <summary> |
| 1005 | /// Adds inline directory syntax generated identifier. | ||
| 1006 | /// </summary> | ||
| 1007 | /// <param name="inlineSyntax">Inline directory syntax the identifier was generated.</param> | ||
| 1008 | /// <param name="id">Generated identifier for inline syntax.</param> | ||
| 1009 | internal void AddInlineDirectoryId(string inlineSyntax, string id) | ||
| 1010 | { | ||
| 1011 | this.activeSectionCachedInlinedDirectoryIds.Add(inlineSyntax, id); | ||
| 1012 | } | ||
| 1013 | |||
| 1014 | /// <summary> | ||
| 1004 | /// Creates a new section and makes it the active section in the core. | 1015 | /// Creates a new section and makes it the active section in the core. |
| 1005 | /// </summary> | 1016 | /// </summary> |
| 1006 | /// <param name="id">Unique identifier for the section.</param> | 1017 | /// <param name="id">Unique identifier for the section.</param> |
| @@ -1011,7 +1022,7 @@ namespace WixToolset.Core | |||
| 1011 | { | 1022 | { |
| 1012 | this.ActiveSection = this.CreateSection(id, type, codepage, compilationId); | 1023 | this.ActiveSection = this.CreateSection(id, type, codepage, compilationId); |
| 1013 | 1024 | ||
| 1014 | this.activeSectionInlinedDirectoryIds = new HashSet<string>(); | 1025 | this.activeSectionCachedInlinedDirectoryIds = new Dictionary<string, string>(); |
| 1015 | this.activeSectionSimpleReferences = new HashSet<string>(); | 1026 | this.activeSectionSimpleReferences = new HashSet<string>(); |
| 1016 | 1027 | ||
| 1017 | return this.ActiveSection; | 1028 | return this.ActiveSection; |
| @@ -1060,9 +1071,9 @@ namespace WixToolset.Core | |||
| 1060 | /// <param name="sourceName">Optional source name for the directory.</param> | 1071 | /// <param name="sourceName">Optional source name for the directory.</param> |
| 1061 | /// <param name="shortSourceName">Optional short source name for the directory.</param> | 1072 | /// <param name="shortSourceName">Optional short source name for the directory.</param> |
| 1062 | /// <returns>Identifier for the newly created row.</returns> | 1073 | /// <returns>Identifier for the newly created row.</returns> |
| 1063 | internal Identifier CreateDirectoryRow(SourceLineNumber sourceLineNumbers, Identifier id, string parentId, string name, string shortName = null, string sourceName = null, string shortSourceName = null) | 1074 | internal Identifier CreateDirectorySymbol(SourceLineNumber sourceLineNumbers, Identifier id, string parentId, string name, string shortName = null, string sourceName = null, string shortSourceName = null) |
| 1064 | { | 1075 | { |
| 1065 | return this.parseHelper.CreateDirectorySymbol(this.ActiveSection, sourceLineNumbers, id, parentId, name, this.activeSectionInlinedDirectoryIds, shortName, sourceName, shortSourceName); | 1076 | return this.parseHelper.CreateDirectorySymbol(this.ActiveSection, sourceLineNumbers, id, parentId, name, shortName, sourceName, shortSourceName); |
| 1066 | } | 1077 | } |
| 1067 | 1078 | ||
| 1068 | public void CreateWixSearchSymbol(SourceLineNumber sourceLineNumbers, string elementName, Identifier id, string variable, string condition, string after) | 1079 | public void CreateWixSearchSymbol(SourceLineNumber sourceLineNumbers, string elementName, Identifier id, string variable, string condition, string after) |
| @@ -1070,18 +1081,6 @@ namespace WixToolset.Core | |||
| 1070 | this.parseHelper.CreateWixSearchSymbol(this.ActiveSection, sourceLineNumbers, elementName, id, variable, condition, after, null); | 1081 | this.parseHelper.CreateWixSearchSymbol(this.ActiveSection, sourceLineNumbers, elementName, id, variable, condition, after, null); |
| 1071 | } | 1082 | } |
| 1072 | 1083 | ||
| 1073 | /// <summary> | ||
| 1074 | /// Gets the attribute value as inline directory syntax. | ||
| 1075 | /// </summary> | ||
| 1076 | /// <param name="sourceLineNumbers">Source line information.</param> | ||
| 1077 | /// <param name="attribute">Attribute containing the value to get.</param> | ||
| 1078 | /// <param name="resultUsedToCreateReference">Flag indicates whether the inline directory syntax should be processed to create a directory row or to create a directory reference.</param> | ||
| 1079 | /// <returns>Inline directory syntax split into array of strings or null if the syntax did not parse.</returns> | ||
| 1080 | internal string[] GetAttributeInlineDirectorySyntax(SourceLineNumber sourceLineNumbers, XAttribute attribute, bool resultUsedToCreateReference = false) | ||
| 1081 | { | ||
| 1082 | return this.parseHelper.GetAttributeInlineDirectorySyntax(sourceLineNumbers, attribute, resultUsedToCreateReference); | ||
| 1083 | } | ||
| 1084 | |||
| 1085 | internal WixActionSymbol ScheduleActionSymbol(SourceLineNumber sourceLineNumbers, AccessModifier access, SequenceTable sequence, string actionName, string condition = null, string beforeAction = null, string afterAction = null, bool overridable = false) | 1084 | internal WixActionSymbol ScheduleActionSymbol(SourceLineNumber sourceLineNumbers, AccessModifier access, SequenceTable sequence, string actionName, string condition = null, string beforeAction = null, string afterAction = null, bool overridable = false) |
| 1086 | { | 1085 | { |
| 1087 | return this.parseHelper.ScheduleActionSymbol(this.ActiveSection, sourceLineNumbers, access, sequence, actionName, condition, beforeAction, afterAction, overridable); | 1086 | return this.parseHelper.ScheduleActionSymbol(this.ActiveSection, sourceLineNumbers, access, sequence, actionName, condition, beforeAction, afterAction, overridable); |
