After excluding the working directory of GAMSPy from Windows Defender settings, the resource usage of Windows Defender dropped quite a bit but still it consumes more resources than the actual program. You can do the exclusion as follows:

I don’t think there is much we can do after this point. If you have a performance critical experiment, it’s probably better to use a Unix-based operating system.