Loading thread on windows slow compared to linux!
Hi, I have an issue with a loading thread on windows (with NVIDIA), while rendering a progress bar on the screen.
All work fine but, if i load a map without thread, just the main thread, it take like 700ms, If I use a loading thread, to load the map, create the shaders etc... on my laptop (NVIDIA GTX 770M, 3 GB) it take 5-6 seconds more (Windows 8)!!
On linux with ATI, (macbookpro 2011), it take the same time with or without the loading thread (around 1.5 seconds).
So is windows so crap, or I need to change the thread priority? I use std::thread on windows and linux.
Thanks for any advise!
There are just so many variable factors here that it's impossible to give you an answer. Windows or Linux? Different versions of the std libraries? NVIDIA or AMD? Different drivers? Even different chipsets, different types of RAM, etc, will be contributing factors. Even your own code seems potentially suspect here (why is it slower with the thread in one case and no change at all in the other case?)
Of all of these, the OS itself is going to be the least important, so I'm not too certain why you homed in specifically on that. If you want to do an OS to OS comparison, you really need to rule everything else out as potential contributing factors; only then can you start making really meaningful statements.
It's hard to tell what is the real problem I know, but my new laptop is like 10 times faster (and prob more, with better RAM) just for the video card, and better CPU, and 5 times slower when loading thread is used, also all data are in SSD drive while the other old laptop use a standard HD.
I would like to test this on my laptop with linux but so far linux cannot be installed, I need to wait until they resolve the installation issues, so i am stuck with windows.
But my question is legit, what can I do to resolve the issue, I am sure I am not the only one having this kind of issues. Is this is related to thread priority, or something else... 700ms vs 5.5 seconds is like terrible
and the only thing I can think of is related to priority or something along that line on windows, since thread priority on windows vs linux are quite different.
A possible explanation would be if you're using Sleep calls anywhere in your loading thread; these can be quite sucky on Windows owing to poor timer resolution.
thanks for the reply again, I checked my code, I do not do any sleep in t he loading thread, the only think I do is mutex lock/unlock when I update my resource, kind of a resource manager, so the main thread can check what resource is loaded or percentage of resource etc... and right now my main thread will lock/unlock the resource manager one time per frame for a very tiny fraction of that time, same code in linux...
The sleep I have is only in my render thread to keep the FPS to 60 max, instead of doing 500 FPS.
ok seomthing weird appened, I needed to reboot my computer, a windows 8 update came, after that, all my problems with loading thread are resolved, now it take 900ms instead of 5.5 seconds!
finally after further test, i discovered the issue, it seam when I connect an HDMI monitor in my laptop, when i start my game it run on the monitor super fast 900ms with loading thread, as soon I disconnect the monitor, only using laptop monitor, it return back to around 5 seconds, even if my app use NVIDIA card not the crappy intel one, its slow, I dont understand why its fast when I plug another monitor!
Your loading thread is not making any GDI, OpenGL, or DirectX calls, correct?
Run a process monitor and look for anything else sucking cycles from your system.
the loading thread, just set current context, load a map, the map create the VBO, IBO, Texture and shaders needed. Nothing is draw from this thread.
I know that as soon I plug a monitor in my laptop, all app use NVIDIA video card, but if no monitor connected, each program use by default the intel card unless its specified to run with NVIDIA, my app run on NVIDIA, I have a game that have a similar problem, Natural Selection 2, is really slow while loading, I did not test with my monitor yet but I suspect I have the same issues as this game...
What process monitor tools do you suggest to use?