Lower performance on better hardware?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
emery303
Prole
Posts: 4
Joined: Thu Sep 05, 2019 6:55 am

Lower performance on better hardware?

Post by emery303 »

Hi LÖVE community,

Checked the topics and the wiki but didn't find relevant stuff that might help me, so I'm asking you.

I'm new to the whole Love2D framework, and just starting out, but I encountered a weird phenomenon regarding performance when running the final EXE on a different machine.

Scenario:

- In every update() there are a bunch of calculations and shader parameter assignments, and a sleep() to cap the FPS at 30. (this is important for timing)
- The draw() function just loops through all drawable assets and put them on the screen
- There is a main soundtrack playing which drives what happens by determining the playback sample position in every update() and adjusting control values accordingly, so what happens on screen depends on where the playback is at.
- That said, the program is just a gfx demo, no user interaction happens nor is it handled.

The whole thing runs smoothly on my laptop, without problems. I assemble the final .exe by packing everything into one file (so all sound and image files are inside the executable and handled static). In the final distribution dir only the .exe and the necessary DLLs are present.

I transfer this to a desktop machine, and the framerate is drastically lower. Sound is playing properly, and everything happens according to playback positions, but in an extremely sluggish manner. Clearly there are way less update()-s per second, though I'd expect that it runs a lot more, hence the framerate cap mentioned before.
I have no idea what goes wrong. I tried forcing the execution to 1 CPU (though I never multithreaded anything in the code), I also checked if the OS refuses to use the 3D acceleration, but it's not the case.

Development machine:
- Windows 8.1 x64
- Intel Core i7 (4th Gen) 4720HQ / 2.6 GHz Quad-Core
- 12GB RAM
- NVIDIA GeForce GTX 860M

Desktop machine:
- Windows 10 x64
- Intel Core i7-7700K 4.20GHz 8 core
- 32GB RAM
- NVIDIA Quadro P600

If you have any ideas what to look out for, or best practices to ensure same behavior on different systems, please throw in your two cents.

Cheers!
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Lower performance on better hardware?

Post by ivan »

Doesn't matter if you a running an .exe or .love the performance should be more or less the same. Might have a slight difference when booting up but NO, that wouldn't affect your performance much.
Don't use sleep, use vsync if you absolutely have to. If your update and draw functions are separate then you don't need to "cap the FPS", just update your game less frequently. Canvases could help if you are aiming for 30 FPS.
Shaders could have wildly different performance based on your graphics card. That being said, if you really want to know what is causing the lag the only reasonable way is to use a profiler. Checkout my very own profile.lua:
https://love2d.org/forums/viewtopic.php?t=80759
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

Re: Lower performance on better hardware?

Post by pgimeno »

Drivers are always the first thing to check in these cases. Try updating the desktop to the latest nVidia drivers if you haven't already.

See how many FPS you're actually getting. A simple method is to use this in love.draw or love.update:

Code: Select all

love.window.setTitle(tostring(love.timer.getFPS()))
Try also disabling vsync and your frame rate cap, and check the values that way, to rule out some weird syncing problem.

ISTR people reporting performance regressions in some cases when using OpenGL 3+ with some drivers. One thing to try is to set the environment variable LOVE_GRAPHICS_USE_GL2 to 1, and see if that changes anything. Using a nightly build of the WIP LÖVE 11.3 might help determining if it's one of the performance regressions that were already patched.
emery303
Prole
Posts: 4
Joined: Thu Sep 05, 2019 6:55 am

Re: Lower performance on better hardware?

Post by emery303 »

Thanks for the tips guys.

Updated all drivers but no luck.
I'm gonna check the vsync and OpenGL settings, I don't remember setting those up in particular so there might be something.

@Ivan: gonna take a look at your profiler too, thx!
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Lower performance on better hardware?

Post by raidho36 »

I've looked up your workstation GPU and it doesn't look like a very powerful unit; benchmarks say it's about 8 times weaker than a 1080ti. Could the problem be simply down to the fact that you're using underpowered hardware to drive a very high resolution monitor?
emery303
Prole
Posts: 4
Joined: Thu Sep 05, 2019 6:55 am

Re: Lower performance on better hardware?

Post by emery303 »

The monitor's resolution is standard full HD native.
Also that Quadro P600 in the desktop runs everything super smooth on Shadertoy.com for example, while my notebook can barely display the front page. Yet my shaders work good on my laptop and lag on the desktop :/
User avatar
Sasha264
Party member
Posts: 131
Joined: Mon Sep 08, 2014 7:57 am

Re: Lower performance on better hardware?

Post by Sasha264 »

Simple test: try to run your app in windowed mode with small window size. Generally if the overall performance depends on shader performance then you will see great increase.
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Lower performance on better hardware?

Post by zorg »

From wikipedia:
The performance difference comes in the firmware controlling the card.[citation needed] Given the importance of speed in a game, a system used for gaming can shut down textures, shading, or rendering after only approximating a final output—in order to keep the overall frame rate high. The algorithms on a CAD-oriented card tend rather to complete all rendering operations, even if that introduces delays or variations in the timing, prioritising accuracy and rendering quality over speed. A Geforce card focuses more on texture fillrates and high framerates with lighting and sound, but Quadro cards prioritize wireframe rendering and object interactions.
In other words, Quadro cards aren't for gaming or any fast response stuff, even if their specs may seem higher (and in your case, is two "generations" newer), so that may be the actual issue.

If not though, then there are still the things others have said previously that you can check:
- Getting rid of love.timer.sleep and implementing a better syncing/timing mechanism (vsync definitely to not push the gpu!) as ivan said.
- Trying the environment variable as pgimeno said.

Also, the sound will play flawlessly for one or both of two reasons: OpenAL soft runs on a separate thread, so that's not affected by the sleep calls or whatever else, and/or it's not something touching your GPU at all.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
emery303
Prole
Posts: 4
Joined: Thu Sep 05, 2019 6:55 am

Re: Lower performance on better hardware?

Post by emery303 »

OK it turned out that the Quadro really didn't handle the shaders that well (still leaves me bummed about why Shadertoy runs flawlessly). In a small window it went okay.

At the end I implemented a timing logic that is depending on current FPS rate by comparing the current FPS to the reference (30 or 60) and adjusting all movement / shader parameters accordingly. It still lags, but at least everything is on time and it never goes out of sync.
I'm gonna get a better gfx card for another test later.
Post Reply

Who is online

Users browsing this forum: No registered users and 51 guests