Eric, I did post the algorithm ( http://www.htmlgoodies.com/primers/jsp/article.php/3622321 - look at the Flood Fill algorithm) Note that there is a recursive implementation, and a stack based while-loop implementation. Although the stack-based loop implementation is slightly better, I still run into performance issues, as I am dealing a pixel to pixel basis.
I guess I can do some research into alternative algorithms (which is going to be hard). - Preet On 5/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Perhaps if you post your algorithm we can help. ----- Original Message ---- From: Preet Shihn <[EMAIL PROTECTED]> To: Mozdev Project Owners List <[email protected]> Sent: Monday, May 7, 2007 3:14:31 PM Subject: Re: [Project_owners] intensive recursions in Javascript I am using Canvas.. I can not use SVG... well not now at least, unless i revamp a whole lot of code. Filling is easy using canvas at the time you want to draw, but filling later..after it has been drawn requires pixel manipulation, for which I am using the flood fill algorithm. I guess I can use window.setTimeout but it will just avoid that script dialog to pop-up, but the whole performance issue still exists. I am going to try it and see what performance stats I get. - Preet On 5/7/07, Matthew Wilson <[EMAIL PROTECTED]> wrote: > > Preet Shihn wrote: > > Heyas! > > > > I am a semi-javascript newbie. I noticed that Javascript isn't really > > great with long running recursive methods or a long running while loop > > that can be memory intensive. > > I see the browser popup "A script on the page may be busy, or it may > > have stopped responding..... Stop the script or continue". I was > > wondering how people have dealt with this. An example of such a method > > > that I was implementing is Flood Fill. Basically, fill a contoor with > a > > specified colour. > > Can you use SVG or Canvas to avoid the work? > > Or use window.setTimeout to split up the work you're doing into chunks? > > Matthew > _______________________________________________ > Project_owners mailing list > [email protected] > http://mozdev.org/mailman/listinfo/project_owners > _______________________________________________ Project_owners mailing list [email protected] http://mozdev.org/mailman/listinfo/project_owners _______________________________________________ Project_owners mailing list [email protected] http://mozdev.org/mailman/listinfo/project_owners
_______________________________________________ Project_owners mailing list [email protected] http://mozdev.org/mailman/listinfo/project_owners
