Slowdown when putting symbols into image data
William Prothero
prothero at earthednet.org
Tue Sep 9 17:28:03 EDT 2014
Jacqueline:
Sounds like a good idea. I don’t see how, though, that you would be able to display a LOT of identical symbols on a map using a single polygon graphic. Don’t you have to create and place each one? That would mean thousands of graphic objects. Is that what you mean?
Bill
On Sep 9, 2014, at 12:09 PM, J. Landman Gay <jacque at hyperactivesw.com> wrote:
> On 9/9/2014, 12:51 PM, William Prothero wrote:
>> Seems I’ve found the offending line in my draw script. Its:
>>
>>> > put byte 1 to tLength of tbrushBinaryData into byte tNewStart * 4 - 3 to tNewStart*4 - 3 + tLength -1 of imgdata -- insert brushimageData into image
>> If I comment out this line, the symbols are drawn in 2.85 seconds, more than a factor of 10 speedup.
>
> This would be similar to using a "repeat with x = 1 to 1000" structure. Every time through the loop the engine has to count from byte 1 to tNewStart. An image has lots of bytes, so all that counting makes it slow.
>
> I had a very similar requirement in my current project, I had to create hundreds of small images on top of a map. I never bothered to try drawing into the map image, I knew it would take forever. Instead I used a polygon graphic and set its points to the locations I needed, and set its markers to the symbol I wanted to display. I needed one graphic per symbol type, but that still cut down the number from hundreds to five.
>
> You may remember my thread about setting markers so they would resize correctly. It was very helpful and I was able to do what I needed. Setting the points of a graphic is instantaneous, there was no delay at all. If your goal is similar to mine, you might want to drop the painting method and just go with the graphics approach.
>
> --
> Jacqueline Landman Gay | jacque at hyperactivesw.com
> HyperActive Software | http://www.hyperactivesw.com
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list