Is a DLL slower than a static link?

前端 未结 4 1053
不思量自难忘°
不思量自难忘° 2021-02-19 14:02

I made a GUI library for games. My test demo runs at 60 fps. When I run this demo with the static version of my library it takes 2-3% cpu in taskmanager. When I use the DLL vers

4条回答
  •  遇见更好的自我
    2021-02-19 14:58

    Do not start your performance timer until the DLL has had opportunity to execute its functionality one time. This gives it time to load into memory. Then start the timer and check performance. It should then basically match that of the static lib.

    Also keep in mind that the load-location of the DLL can greatly affect how quickly it loads. The default base addres for DLLs is 0x400000. If you already have some other DLL in that location, then the load process must perform an expensive re-addressing step which will throw off your timing even more.

    If you have such a conflict, just choose a different base address in Visual Studio.

提交回复
热议问题