Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Massive variation in texture loading time on different computers  (Read 1906 times)

0 Members and 1 Guest are viewing this topic.

awr

  • Newbie
  • *
  • Posts: 15
    • View Profile
Hi,

I was running a test on two of my machines with the following specs:

Machine 1 (laptop - set to Maximum Performance):
Intel I5-2520M @ 2.50GHz
4GB ram
Intel HD graphics 3000 @ 650MHz
Windows 7
750

Machine 2 (desktop):
Intel i5-760 @ 2.7GHz
Nvidia GTX 260
4GB ram
12000

Machine 3 (desktop):
Intel I5-3350P @ 3.1GHz
6GB ram
NVIDIA GeForce GT 730M
Windows 8
48000

The test was:
Load an image (1200x600) from disk into an sf::Image.
then, in a while loop:
 On every iteration, create an sf::texture from the image
Repeat as fast as possible.

I ran each test for 20 seconds and the results were:
Machine 1: 750 iterations
Machine 2: 12000 iterations
Machine 3: 48000 iterations

Note that I'm not actually drawing anything to the screen. Drawing to the screen didn't have an impact on machine 1's performance, while it reduced machine 2 to 8000 and machine 3's down to about 15000.

Each image is 2.74MB. So essentially, machine 1 was only able to transfer 100MB per second from the CPU to the GPU (or an average of 37.5 textures per second - or 27 ms per texture), whereas machine 3 was transferring 6.5GB per second (2400 textures per second - < 1ms per texture ).

That seems ridiculously slow for the Intel HD Graphics. I was expecting some slow down on the laptop but not so dramatic a difference. Is there anything that could be contributing to this? It just seems ridiculously slow for a circa 2011 machine - I get better performance using .NET and picture boxes to do the rendering.

awr

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Massive variation in texture loading time on different computers
« Reply #1 on: October 12, 2013, 09:35:52 am »
An update - looking closer into the issue, it turns out I had a 2 year old graphics driver on the laptop. Whats more, it looks like it was a generic Intel HD driver, not one for the 3000. I updated the driver and lo and behold, the output went up from 750 textures in 20 seconds to 3000 - a 4x improvement just by updating to the latest driver.   ;D

Certainly far more in line with what'd I'd expect. That'd allow ~150 textures to be uploaded per second - as its for a video player where I'd be uploading at most 30 textures a second, it should provide ample time to decode and resize each frame.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Massive variation in texture loading time on different computers
« Reply #2 on: October 12, 2013, 09:38:26 am »
IGPs use sideport memory most of the time, which is basically a block of memory siphoned of your system's main RAM. Depending on how this is implemented, it can be ridiculously slow to transfer data from RAM to sideport memory although physically it is on the same PCB. This is due to the fact that the abstraction mechanisms in place have to "pretend" there is a physical discrete GPU although there really is none, and the data probably has to travel around half the system to reach its destination. There are so many other things that could contribute to it being slow (how the IGP interrupts are handled, what kind of bus is used to connect IGP and memory controller, what the driver does to provide full OpenGL functionality, sometimes processing is split between IGP and CPU, etc.)

You shouldn't really wonder why something that doesn't promise to be fast is slow. I would worry more if something that promised to be fast really is slow and be surprised if something you would expect to be slow is fast. That being said, I don't know how PictureBox is implemented, but one possibility is that there are optimizations involved in the background that you don't notice. Being from Microsoft, you might also expect it to be implemented in terms of DirectX (with its HAL and HEL it probably provides more room for optimizing IGPs than OpenGL, which is what SFML uses) or more likely GDI which is probably also optimized for IGPs since it is the staple rendering mechanism of the Windows UI.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

awr

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Massive variation in texture loading time on different computers
« Reply #3 on: October 12, 2013, 11:15:03 am »
It's not that I expected it to be fast - it's just that it seemed unreasonably slow. And indeed it was - as I highlighted in my second post, installing the latest driver resulted in a 4x improvement.

Picturebox and the entirety of Winforms uses GDI. I don't believe it uses the hardware at all. I haven't done a objective measure since but I believe with the updated graphics driver SFML renders quicker than native Winforms even on the old, crappy laptop.