Skip to content

Commit 20d862e

Browse files
author
Kapil Borle
committed
Set max runspaces to 3 for getcommandinfo runspacepool
1 parent 585cca9 commit 20d862e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Engine/Helper.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ public void Initialize()
151151
ruleArguments = new Dictionary<string, Dictionary<string, object>>(StringComparer.OrdinalIgnoreCase);
152152
commandInfoCache = new ConcurrentDictionary<string, CommandInfo>(StringComparer.OrdinalIgnoreCase);
153153
runspacePool = RunspaceFactory.CreateRunspacePool(InitialSessionState.CreateDefault2());
154+
155+
// After some experimentation, I found out that setting max runspaces more than 3 has marginal returns.
156+
runspacePool.SetMaxRunspaces(3);
154157
runspacePool.Open();
155158

156159
IEnumerable<CommandInfo> aliases = this.invokeCommand.GetCommands("*", CommandTypes.Alias, true);

0 commit comments

Comments
 (0)