silverhack/monkey365

[Bug]: Very slow Import-Module on NIX OS

Closed this issue · 1 comments

What happened?
Importing the Monkey365 PowerShell module takes a long time on NIX OS. It gives results from 100 to 300 seconds using PowerShell 7.3.3.

PS /home/silverhack> Measure-Command -Expression {Import-Module /mnt/c/monkey365}

Days              : 0
Hours             : 0
Minutes           : 4
Seconds           : 45
Milliseconds      : 873
Ticks             : 2858730254
TotalDays         : 0.00330871557175926
TotalHours        : 0.0794091737222222
TotalMinutes      : 4.76455042333333
TotalSeconds      : 285.8730254
TotalMilliseconds : 285873.0254

How to reproduce it
Steps to reproduce the behavior:
Import Monkey365 on NIX environments

Expected behavior
Monkey365 should load in a reasonable time.

Additional context
Some internal modules seem to load in reasonable time, so I believe it is an issue with Get-ChildItem command. Monkey365 has to dot-source every single internal function (more than 400), and the first time will iterate over directories by using Get-ChildItem cmdLet.

Additional Urls

Why is Get-ChildItem so Slow?
Windows Defender and PowerShell

It's now fixed on dev branch. It will be merged to main branch asap