Sg2.9
My script is nice, but soooo...
Recent RSS
My script is nice, but soooo slow!
From:  Linus
Date:  18. October 2006, 01:01

Hello,

I've pasted my code at the bottom of this message as I don't have anywhere to host it. Here are some examples of what it does.

http://i71.photobucket.com/albums/i147/dj_lino/myraster2.jpg

I think it's pretty nice and has potential to create some great stuff (especially if colour was added to the code). The trouble is that it runs stupidly slow. I think my algorithm is alright - I can't see a better way of doing it. Any suggestions or ideas would be great.

If you're going to try out the code do it on an extremely low resolution image! As the code is at the moment it'll only make four circles (and it'll put them in the bottom corner of the document). If you want more circles then change the code that says
"for(z = 0; z

Re: My script is nice, but soooo slow!
From:  Jürg Lehni
Date:  18. October 2006, 13:20

Without having had a proper look at your code, my guess would be that the reason for it being slow is probably the fact that getting / seting single pixels in rasters is quite slow at the moment. There are a few reasons for this: I cannot directly access the image's data buffer, so I have to transfer pixels back and forth, using an SDK function. This function can be used for transfering bigger chunks, but then the caching overhead becomes complicated. So at the moment, this function is used for transfers of single pixles, which most probably is very slow.

One possibility to make it faster right now would be to retrieve the whole image as a BufferedImage, then work with that, and at the end create a new Raster from it. I am not sure about the implications of color conversion here though.

Re: My script is nice, but soooo slow!
From:  Linus
Date:  15. November 2006, 23:03

Thankyou for your replies. I've had a rest from this, but coming back to it it's pretty obvious where the problem lies. While running the code I can see how long each section takes from what gets printed to the console, and the bit that takes stupidly long is this. It's just a silly number of embedded for loops. Oh well, I think I need a better algorithm!

for (x = 1; x

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Boxes Flow 19.04.12