View Issue Details

IDProjectCategoryView StatusLast Update
0015778Runner[All Projects] FunctionsPublic2019-02-13 13:24
ReporterxotAssigned ToSteven Campbell 
PriorityLowSeverityC - GeneralReproducibility100%
Status ClosedResolutionNo Change Required 
PlatformWindowsOSWindows 7OS VersionUltimate SP1
Product Version 
Target VersionFixed in Version 
Summary0015778: draw_getpixel() and surface_getpixel() degrade performance with continued use
DescriptionContinuous use of draw_getpixel() or surface_getpixel() causes decreased performance over time. Each call to them takes longer than the last.

Affects Windows and Windows (YYC). HTML5 appears to work without performance problems. I am unable to test other platforms.
Steps To ReproduceThe attached demonstration displays the number of microseconds it takes to perform 100 draw_getpixel() calls. As the demo runs the number gets larger and larger. Below that it displays the value of fps_real. As the demo runs the value decreases. Below that are a series of numbers (1111111, 2222222, etc) which confirm the colors are being read correctly.

Press SPACE to see surface_getpixel() tested in the same way.
TagsNo tags attached.
1.4 Found In1.4.1398
2.x Runtime Found In
2.x Runtime Verified In

Activities

xot

2014-08-19 21:16

Updater  

getpixel_performance.gmz (934,079 bytes)

Neil Wicker

2014-08-20 17:16

Updater   ~0032057

Reproduced - assigned.

Neil Wicker

2014-11-19 15:46

Updater   ~0034262

Still happens in EA299, assigning on.

xot

2015-01-29 19:11

Updater   ~0035513

Last edited: 2015-01-29 20:24

View 4 revisions

I was testing a script today that uses surface_getpixel() extensively to replace sprite colors, ie. http://www.gmlscripts.com/script/sprite_replace_color_blend

It took 46 minutes to complete the script running on a 128x128 pixel sprite with 8 subimages (131072 surface_getpixel() calls). In the process, 240MB of memory was consumed which was released at the end of the script. Fortunately, the script worked the first time.

The same script takes 36 seconds to run with GM7, 31 seconds with GM8.1.

Russell Kay

2018-05-11 17:06

Manager   ~0059613

This is not a bug these are very intensive functions as they break the drawing pipeline and cause a read back over the bus - better to batch these and use a buffer_get_surface() to do a whole lot at once (also cycle buffers and run several frames behind is a good idea).

Dan

2019-02-13 13:24

Adminstrator   ~0062905

Closing per the Resolution of No Change Required.