YOUR ACCOUNT

Login or Register to post new topics or replies
Sphinxmorpher
Filter Optimizer

Posts: 1750
Filters: 39
I'm trying to do a simple loop that finds the closest color to a given sample.
After just 5 iterations things start to slow down seriously.

Obviously some sort of exponential branching is going on here, but I don't understand why, as there are no distorters involved.

What am I doing wrong?

Closest Color.ffxml
  Details E-Mail
rachelduim
So Called Tortured Artist

Posts: 2498
Filters: 188
Yeah, loops are touchy. I think (?) that the 2 subtract/multiply paths into the Threshold are enough to make it exponential. When I have been dissatisfied with loop performance, I've reverted to Group ganging into a Switch, I've attached your code modified in this way, I think you'll be amazed by the speed improvement. FF8 only.

Closest Color group.ffxml
Math meets art meets psychedelia.
  Details E-Mail
Sphinxmorpher
Filter Optimizer

Posts: 1750
Filters: 39
Thanks - yeah, unrolling the loop does indeed improve speed - and we see no exponential performance issue (which makes me think the loop sample cache is broken or something). Unrolling the loop also kinda defeats the purpose of the loop with regard to iteration flexibility smile;-)

(I am working on a variant of my old Collage filter btw: https://filterforge.com/filters/9982.html)
  Details E-Mail
rachelduim
So Called Tortured Artist

Posts: 2498
Filters: 188
Actually, you created this thread: https://filterforge.com/forum/read.php...sage118632
The problem with looping is "explosive recursion", which exponentially increases execution time if there is ANY branching in the loop. My conclusion, if you use looping, it will always be slower unless the loop is strictly "linear" with no branching. Given the architecture FF uses, I don't know if this is fixable. At least for now, I think that creating the loop for a filter, then going with the "group ganging" technique is the only "workaround" available if speed is an issue in your filter.
Math meets art meets psychedelia.
  Details E-Mail
Sphinxmorpher
Filter Optimizer

Posts: 1750
Filters: 39
Yeah, it was flagged already back then. I also mention a related issue here it seems:
https://filterforge.com/forum/read.php?TID=15210 .. Lets just hope that they one day figure it out. Thanks for your input.
  Details E-Mail

Join Our Community!

Filter Forge has a thriving, vibrant, knowledgeable user community. Feel free to join us and have fun!

33,711 Registered Users
+18 new in 30 days!

153,531 Posts
+39 new in 30 days!

15,347 Topics
+72 new in year!

Create an Account

Online Users Last minute:

25 unregistered users.