-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve code-behind feature file compilation speed (#336)
* TestGenerator: Don't call VB.NET fixes when compiling C# code and compile RegEx in VB.NET * ReqnrollGherkinParserFactory: Cache ReqnrollGherkinDialectProvider * ScenarioPartHelper: Avoid Enum reflaction * ReqnrollGherkinDialectProvider: Avoid NoSuchLanguageException
- Loading branch information
Showing
6 changed files
with
42 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
using Gherkin; | ||
using System; | ||
using System.Collections.Concurrent; | ||
using System.Globalization; | ||
|
||
namespace Reqnroll.Parser | ||
{ | ||
public class ReqnrollGherkinParserFactory : IGherkinParserFactory | ||
{ | ||
readonly ConcurrentDictionary<string, ReqnrollGherkinDialectProvider> _CachedDialectProvider = new ConcurrentDictionary<string, ReqnrollGherkinDialectProvider>(); | ||
static readonly Func<string, ReqnrollGherkinDialectProvider> _DialectProviderFactory = (defaultLanguage) => new ReqnrollGherkinDialectProvider(defaultLanguage); | ||
|
||
public IGherkinParser Create(IGherkinDialectProvider dialectProvider) => new ReqnrollGherkinParser(dialectProvider); | ||
|
||
public IGherkinParser Create(CultureInfo cultureInfo) => new ReqnrollGherkinParser(cultureInfo); | ||
public IGherkinParser Create(CultureInfo cultureInfo) => new ReqnrollGherkinParser(_CachedDialectProvider.GetOrAdd(cultureInfo.Name, _DialectProviderFactory)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters