Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Get image method very slow on newer laptop, but not older one.

Author
Message
Ben_UK78
13
Years of Service
User Offline
Joined: 10th Jul 2010
Location:
Posted: 20th Nov 2014 04:46 Edited at: 20th Nov 2014 05:57
Hi All,

I have a strange issue and I wondered if anyone could help.

I draw a series of graphs with 9 lines each with 450 data points. I keep a background stored in a memblock, make a bitmap from that memblock, draw the lines to it, use get image to make an image of it, then paste the image to the screen. I do this only when I need to.
The program (which does alot of other things) runs at around 300fps on my laptop. Updating the charts takes around 30ms.

I have another laptop at work. When I run the program on that it runs at around 240fps (still fine), but when I update the charts (scroll them etc) it takes 400ms to update (instead of 30ms as per my own laptop) and the frame rate drops to 1-2fps while scrolling.

My laptop (taking 30ms to draw the charts) is Win 7 with a NVidia Geforce GT420M, whereas the work laptop has is Win 8.1 with a Radeon R3. The Radeon is years newer than the Geforce in my old laptop and on paper is more powerful.

I don't understand why on my older laptop the update takes 30ms, but on the newer laptop takes 400ms.

Also, is my method above [from saved memblock>new bitmap>draw data>get image>paste image] the best way of creating a fresh image with a preset background with 9 lines of data with 450 points per line. Are there any stages I can miss out?

I hope that makes some sense.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 20th Nov 2014 10:57
Quote: "Also, is my method above [from saved memblock>new bitmap>draw data>get image>paste image] the best way of creating a fresh image with a preset background with 9 lines of data with 450 points per line. Are there any stages I can miss out?"

If your memblock contains the pixel data you can draw directly to the memblock (if you have some "base" image in your memblock that you need to preserve while drawing the lines separatedly you can use another memblock of the same dimensions as the base one for drawing the lines to). You can then bypass the bitmap creation, swapping and image getting completely and just make an image from the memblock directly. This should definately be fast enough for realtime use even on "not-too-great" computers.

What may be causing the significantly worse slowdowns on your laptop is that your approach probably uses the CPU a lot more than the GPU and is thus bottlenecked by that instead. It still seems a bit extreme that it is ~12.5 times slower though. But anyway, try what I suggested above, that should theoretically run at at least several dozen frames per second and quite likely in the hundreds

Ben_UK78
13
Years of Service
User Offline
Joined: 10th Jul 2010
Location:
Posted: 23rd Nov 2014 04:39
Well, it turns out that almost all of that time was coming from the get image commands. 3 get images took 18ms on 1 laptop and nearly 300ms on the other. I used IanM's Matrix1Util33 MAKE IMAGE and DRAW TO IMAGE commands and used paste image to paste my backdrop into the MAKE IMAGE image. This removed the need for the get image steps completely (as I just wrote directly to the image) and now the program runs perfectly on both laptops. No idea why get image had such problems on an AMD A4-6210 APU compared to my Core i5-460M, but with get image removed the program runs about the same on both laptops.

Thanks for the suggestion.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 23rd Nov 2014 12:56
Sounds like a useful result. Bookmarked.



Powered by Free Banners

Login to post a reply

Server time is: 2024-04-19 10:07:31
Your offset time is: 2024-04-19 10:07:31