You may want to also consider collecting some information with a tool like DebugDiag: https://www.toptal.com/dot-net/hunting-high-cpu-usage-in-dot-net
Although it might not point to the exact script or endpoint, it may point to whether this is an issue with UD itself of something that you script is exhibiting.