Skip to content

Commit 64ff906

Browse files
authored
Remove RegexOptions.Compiled for code paths executed during cold start. (#6708)
1 parent 8ee1fb5 commit 64ff906

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

src/WebJobs.Script/Description/DotNet/Compilation/Raw/RawAssemblyCompilation.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ namespace Microsoft.Azure.WebJobs.Script.Description
1414
{
1515
public class RawAssemblyCompilation : IDotNetCompilation
1616
{
17-
private static readonly Regex _entryPointRegex = new Regex("^(?<typename>.*)\\.(?<methodname>\\S*)$", RegexOptions.Compiled);
17+
// RegexOptions.Compiled is specifically removed as it impacts the cold start. The default uses interpreter.
18+
private static readonly Regex _entryPointRegex = new Regex("^(?<typename>.*)\\.(?<methodname>\\S*)$");
1819
private readonly string _assemblyFilePath;
1920
private readonly string _entryPointName;
2021

src/WebJobs.Script/Description/FunctionDescriptorProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Microsoft.Azure.WebJobs.Script.Description
1919
{
2020
public abstract class FunctionDescriptorProvider
2121
{
22-
private static readonly Regex BindingNameValidationRegex = new Regex(string.Format("^([a-zA-Z][a-zA-Z0-9]{{0,127}}|{0})$", Regex.Escape(ScriptConstants.SystemReturnParameterBindingName)), RegexOptions.Compiled);
22+
private static readonly Regex BindingNameValidationRegex = new Regex(string.Format("^([a-zA-Z][a-zA-Z0-9]{{0,127}}|{0})$", Regex.Escape(ScriptConstants.SystemReturnParameterBindingName)));
2323

2424
protected FunctionDescriptorProvider(ScriptHost host, ScriptJobHostOptions config, ICollection<IScriptBindingProvider> bindingProviders)
2525
{

src/WebJobs.Script/Host/ProxyFunctionProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Microsoft.Azure.WebJobs.Script
2323
{
2424
public class ProxyFunctionProvider : IFunctionProvider, IDisposable
2525
{
26-
private static readonly Regex ProxyNameValidationRegex = new Regex(@"[^a-zA-Z0-9_-]", RegexOptions.Compiled | RegexOptions.IgnoreCase);
26+
private static readonly Regex ProxyNameValidationRegex = new Regex(@"[^a-zA-Z0-9_-]", RegexOptions.IgnoreCase);
2727
private readonly ReaderWriterLockSlim _metadataLock = new ReaderWriterLockSlim();
2828
private readonly IOptions<ScriptJobHostOptions> _scriptOptions;
2929
private readonly IEnvironment _environment;

src/WebJobs.Script/Utility.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static class Utility
3333
// i.e.: "f-<functionname>"
3434
public const string AssemblyPrefix = "f-";
3535
public const string AssemblySeparator = "__";
36-
private static readonly Regex FunctionNameValidationRegex = new Regex(@"^[a-z][a-z0-9_\-]{0,127}$(?<!^host$)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
36+
private static readonly Regex FunctionNameValidationRegex = new Regex(@"^[a-z][a-z0-9_\-]{0,127}$(?<!^host$)", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
3737

3838
private static readonly string UTF8ByteOrderMark = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble());
3939
private static readonly FilteredExpandoObjectConverter _filteredExpandoObjectConverter = new FilteredExpandoObjectConverter();

0 commit comments

Comments
 (0)