When starting my program without Task Scheduler, it has memory priority of 5 like all other programs running in my system (Windows 7).
But when running under Task Scheduler, it has memory priority of 4, and it impact performance.
Note! Process priority is Normal (CPU Priority 8) so this is not the problem! Only memory priority is the problem!
Process Explorer screenshot:
How to change the memory priority of a scheduled task to 5? Win32 API is an acceptable solution.
Apparently there's no way to tell Task Scheduler to not adjust the memory priority. But it can be done programmatically. See this thread over at Serverfault: https://serverfault.com/questions/151824/process-runs-slower-as-a-scheduled-task-than-it-does-interactively