ID 595766 - Nuke takes longer to load while NUKE_PATH or .nuke contains a large amount of files

Follow

Problem summary
Nuke takes longer to load while NUKE_PATH or .nuke hosts a substantial amount of files.
 
Customer reported version
Nuke 15.1v4
 
Customer reported platform
Windows 11
 
Steps to reproduce 
1) Open a Command Prompt/Terminal and set the environment variable for NUKE_PATH to a folder with lots of files and directories. 
Example on Windows: set NUKE_PATH=C:\Temp\thousandfiles
 
2) In the same terminal session, path to the Nuke installation directory and launch Nuke, observing the time to load.
 Example verbose command from C:\Program Files\Nuke15.1v2: Nuke15.1.exe -V 2
 
Expected behavior
Nuke should load without hinderance when reading files in the NUKE_PATH or .nuke locations.
 
Actual behavior
Nuke can take a long time to load when NUKE_PATH or the .nuke directory has lots of files. Nuke opened after 23 minutes and 25 seconds when having the folder with 1 million jpg files. Older versions of Nuke (14.1v1 and before) would only take up to 45 seconds for the same amount of files, and would even take less than that with only 15 seconds in Nuke 12.2.
 
Workaround
There is no available workaround at this time.
 
Reproduced by Support in:
Nuke 15.1v2 - Windows 10/11, macOS 13 Ventura
Nuke 14.1v2 - Windows 10/11, macOS 13 Ventura - regression
 
Unable to reproduce bug in:
Nuke14.1v1 - Windows 10/11, macOS 13 Ventura
 
Earliest version tested
Nuke 14.1v1 - This issue doesn't appear in this version and has regressed

    We're sorry to hear that

    Please tell us why