View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0015778||Runner||[All Projects] Functions||Public||2014-08-19 21:16||2019-02-13 13:24|
|Reporter||xot||Assigned To||Steven Campbell|
|Priority||Low||Severity||C - General||Reproducibility||100%|
|Status||Closed||Resolution||No Change Required|
|Platform||Windows||OS||Windows 7||OS Version||Ultimate SP1|
|Target Version||Fixed in Version|
|Summary||0015778: draw_getpixel() and surface_getpixel() degrade performance with continued use|
|Description||Continuous 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 Reproduce||The 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.
|Tags||No tags attached.|
|1.4 Found In||1.4.1398|
|2.x Runtime Found In|
|2.x Runtime Verified In|
getpixel_performance.gmz (934,079 bytes)
|Reproduced - assigned.|
|Still happens in EA299, assigning on.|
Last edited: 2015-01-29 20:24
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.
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).
||Closing per the Resolution of No Change Required.|