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

Author Topic: Image::LoadFromFile very slow  (Read 4550 times)

0 Members and 1 Guest are viewing this topic.

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Image::LoadFromFile very slow
« on: May 15, 2011, 10:45:26 pm »
Hi

I've just started implementing SFML and so far, VERY IMPRESSED!

I'm loading 5x 2048x2048 PNG images, then creating sprites from them. It works just fine, but loading the actual files is very slow (~12 seconds for all 5). On the "other" library I used to use, this was very fast, maybe 3 seconds total for all 5 files. The files are between 650k and 3.3mb (some are almost empty files).

I guess it's not the actual loading, but the decompression into memory that takes the time?

Can someone help?

Many Thanks
Ed
SFML 2.1

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Image::LoadFromFile very slow
« Reply #1 on: May 15, 2011, 10:47:32 pm »
Can you upload these images so that I can test them and see which part is slow?
Laurent Gomila - SFML developer

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Image::LoadFromFile very slow
« Reply #2 on: May 15, 2011, 10:48:45 pm »
Sure - can I email them to you, as they're for work and shouldn't be public :D
SFML 2.1

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Image::LoadFromFile very slow
« Reply #3 on: May 15, 2011, 10:57:07 pm »
Sure, no problem.
Laurent Gomila - SFML developer

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Image::LoadFromFile very slow
« Reply #4 on: May 15, 2011, 10:57:54 pm »
Ah sorry - I uploaded them to my dropbox and PM'd you the link

Thanks
Ed
SFML 2.1

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Image::LoadFromFile very slow
« Reply #5 on: May 17, 2011, 11:35:15 am »
Update: I had to recompile the SFML libs to minimize CRT dependancies, and after doing so, then recompiling my game, the delay has gone!

It now takes ~3 seconds to load all 5 PNGs, which is about right, I think.

So I guess there might be something strange in the libraries and maybe it's doing some crazy loading/unloading of DLLs for every image. No idea. But for now, it works for me :)
SFML 2.1

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Image::LoadFromFile very slow
« Reply #6 on: May 17, 2011, 11:39:42 am »
That's really strange :shock:
Laurent Gomila - SFML developer

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Image::LoadFromFile very slow
« Reply #7 on: May 17, 2011, 01:03:24 pm »
Could be there are still some debug code in there? I know that for me to load my .obj model in debug takes like a million years while in release there is no loading time at all, I mean absolutely none! (I think there's somewhere around 10 000 faces in that model)
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Image::LoadFromFile very slow
« Reply #8 on: May 17, 2011, 01:37:06 pm »
Hmm!

There is something strange - in Release mode, it's very fast, in Debug, it's very slow. I am confused :S
SFML 2.1

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Image::LoadFromFile very slow
« Reply #9 on: May 17, 2011, 01:47:05 pm »
Quote
There is something strange - in Release mode, it's very fast, in Debug, it's very slow. I am confused :S

This is not strange at all, debug mode is always slower because the compiler doesn't optimize at all.
Laurent Gomila - SFML developer

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Image::LoadFromFile very slow
« Reply #10 on: May 17, 2011, 02:10:13 pm »
I wouldn't think it was 5x slower due to having the optimization disable, but I'll check my project settings - thanks :)
SFML 2.1

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Image::LoadFromFile very slow
« Reply #11 on: May 17, 2011, 02:35:18 pm »
It is not only the optimizations that are turned off. Debug informations and additional runtime checks lead to further overhead.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything