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

Author Topic: sf::RenderImage::Create extremely slow  (Read 15146 times)

0 Members and 1 Guest are viewing this topic.

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
sf::RenderImage::Create extremely slow
« Reply #15 on: May 14, 2011, 11:36:46 pm »
I am using SFML 2.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::RenderImage::Create extremely slow
« Reply #16 on: May 14, 2011, 11:46:31 pm »
I know... but which SFML 2?
Laurent Gomila - SFML developer

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
sf::RenderImage::Create extremely slow
« Reply #17 on: May 14, 2011, 11:59:09 pm »
Er... the one titled "LaurentGomila-SFML-cb1f938" (I can't find the official version).
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
sf::RenderImage::Create extremely slow
« Reply #18 on: May 15, 2011, 12:25:17 am »
Quote from: "lolz123"
Er... the one titled "LaurentGomila-SFML-cb1f938" (I can't find the official version).


That's a very old commit. It was done: 2011-04-05 (https://github.com/SFML/SFML/commit/cb1f9385825c4645dae1c233684699c6fcb6c0a7) If I get how Github works correctly.

Though looking in the upcoming commits I don't see anything that would have affected this. You never know though, do an update to the latest version.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
sf::RenderImage::Create extremely slow
« Reply #19 on: May 15, 2011, 01:39:08 am »
Ok, I ran it under the newest version of SFML2 (after wrestling with the usual linker errors :roll: ), but the lagging issue persists.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
sf::RenderImage::Create extremely slow
« Reply #20 on: May 15, 2011, 02:39:48 am »
Well all I got left is that it's something to do with your computer/configuration that does it. Do you use visual studio or MinGW? Does it change if you change between them? Does it change if you change computer(interested in a different graphics card)? Ow yeah is the "graphic card" integrated graphics from Intel? Because that shit sucks real hard and could be the source of everything, no matter how good "card" you got.

I am not the developer(Laurent is) so if this is because of the code in sf::RenderImage I can't answer. Though I don't experience the problem your having on my computer so doesn't seem like it.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
sf::RenderImage::Create extremely slow
« Reply #21 on: May 15, 2011, 02:52:05 am »
I doubt it is my machine since I was able to compile and run some OpenGL render to texture demos with zero lag (same thing SFML is trying to do). I could, of course, completely ignore SFML and use the lower level OpenGL render to texture stuff, but if possible I would like to use SFML for this.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::RenderImage::Create extremely slow
« Reply #22 on: May 15, 2011, 10:30:45 am »
It's hard to debug, you're the only one who could find out what happens.

If you want to go further, you can put traces ("std::cout << clock.GetElapsedTime()") in the RenderImage creation code, to find out which line takes so long to execute.
Laurent Gomila - SFML developer

xazax

  • Guest
sf::RenderImage::Create extremely slow
« Reply #23 on: May 15, 2011, 12:26:08 pm »
Or look for and try some kind of profiling solution for debugging.

lolz123

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
sf::RenderImage::Create extremely slow
« Reply #24 on: May 15, 2011, 02:11:23 pm »
I'll let you know if I figure it out.
Have you heard about the new Cray super computer?  It’s so fast, it executes an infinite loop in 6 seconds.

krisando

  • Newbie
  • *
  • Posts: 20
    • View Profile
sf::RenderImage::Create extremely slow
« Reply #25 on: July 15, 2011, 09:22:19 pm »
I think It's time to reincarnate this topic.

Extremely slow may be an understatement, calling create took nearly close to half a second. Doing that during runtime would be very slow. Would it not be possible to reduce this time for creating or adding a resize function to do so?

Tried this with MinGW on a quite high spec laptop, can take a few seconds on older hardware.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
sf::RenderImage::Create extremely slow
« Reply #26 on: July 16, 2011, 10:02:03 am »
Can you show a minimal and complete code that reproduces the problem please?

Do you run your app in release or debug mode?
Laurent Gomila - SFML developer

Haikarainen

  • Guest
sf::RenderImage::Create extremely slow
« Reply #27 on: July 16, 2011, 10:06:38 am »
Viewed this topic and got bored so i made a benchmarker for sf::Image::Create.

It's creating an image the size of 1280x1280, 10 times, and calculates times + average time at the end.

Code: https://legacy.sfmluploads.org/index.php?page=view_code&id=52

My results using SFML2 - release(dont remember the branch im using):

Code: [Select]
Check started at 0.266 seconds

Pass 1:
        Start:          0.268sec
        End:            0.339sec
        Create() took   0.07sec

Pass 2:
        Start:          0.34sec
        End:            0.401sec
        Create() took   0.061sec

Pass 3:
        Start:          0.402sec
        End:            0.464sec
        Create() took   0.062sec

Pass 4:
        Start:          0.465sec
        End:            0.523sec
        Create() took   0.058sec

Pass 5:
        Start:          0.524sec
        End:            0.584sec
        Create() took   0.06sec

Pass 6:
        Start:          0.585sec
        End:            0.646sec
        Create() took   0.06sec

Pass 7:
        Start:          0.648sec
        End:            0.708sec
        Create() took   0.06sec

Pass 8:
        Start:          0.71sec
        End:            0.773sec
        Create() took   0.062sec

Pass 9:
        Start:          0.775sec
        End:            0.838sec
        Create() took   0.063sec

Pass 10:
        Start:          0.839sec
        End:            0.901sec
        Create() took   0.061sec

Check ended at 0.903 seconds

Average time of Create(): 0.061 seconds


And debug:

Code: [Select]
Check started at 0.269 seconds

Pass 1:
        Start:          0.27sec
        End:            0.366sec
        Create() took   0.096sec

Pass 2:
        Start:          0.367sec
        End:            0.455sec
        Create() took   0.088sec

Pass 3:
        Start:          0.456sec
        End:            0.541sec
        Create() took   0.085sec

Pass 4:
        Start:          0.542sec
        End:            0.625sec
        Create() took   0.083sec

Pass 5:
        Start:          0.625sec
        End:            0.708sec
        Create() took   0.082sec

Pass 6:
        Start:          0.71sec
        End:            0.793sec
        Create() took   0.082sec

Pass 7:
        Start:          0.795sec
        End:            0.878sec
        Create() took   0.082sec

Pass 8:
        Start:          0.88sec
        End:            0.964sec
        Create() took   0.083sec

Pass 9:
        Start:          0.966sec
        End:            1.051sec
        Create() took   0.084sec

Pass 10:
        Start:          1.053sec
        End:            1.138sec
        Create() took   0.085sec

Check ended at 1.14 seconds

Average time of Create(): 0.085 seconds

krisando

  • Newbie
  • *
  • Posts: 20
    • View Profile
sf::RenderImage::Create extremely slow
« Reply #28 on: July 16, 2011, 12:46:09 pm »
I made two important mistakes, running it once with the created object included in the time.

Even so 45-90ms is still quite high. Not sure what's involved but if it could be made more efficient or maybe a Resize() function. (Assuming it could be designed to do the job in a smaller time frame). Would be extremely beneficial.

Sure this shouldn't be run every frame, but it is a real fps killer.

xazax

  • Guest
sf::RenderImage::Create extremely slow
« Reply #29 on: July 16, 2011, 01:00:23 pm »
I think, in case of such a dramatic performance drop, the first thing lolz123 should have done is some profiling. Maybe it could point out the performance bottleneck.

 

anything