Is there a way to achieve the same even when the exe is on a local disc?
No there is not. There is no such PE flag. It would be rather pointless one imagines. Why would you want to copy from one location on your disk to another, and then load the copy of the image?
You talk about performance improvement with IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP
and IMAGE_FILE_NET_RUN_FROM_SWAP
, but you've got it the wrong way round. The performance is worse when you use these flags. That's because the entire image has to be read first, before the executable is mapped. Without these PE flags, the image can be mapped and only loaded on demand. Furthermore, you consume space in your swap file that can have negative implications.
You don't use these flags to improve performance because they do not improve performance, they make your program slower to start. You use these flags for reliability. Once the image has been copied to the local swap file, you are less likely to encounter hard page faults when trying to load part of the executable on demand.