fx much slower with variable names longer than 2 chars
Posted: 2008-07-05T11:32:28-07:00
With regard to some latter posts regarding timing of -fx within viewtopic.php?f=2&t=11601&hilit=fx
I did some tests with command line IM 6.4.2-1 Q16 (non-hdri) and found that indeed -fx is an order of magnitude slower when variable names are more than 2 characters long. I think this is something that needs to be fixed for IM 7 if this is not a bug and can be fixed sooner.
Here are my tests in generating a radial gradient using rad=64
2 characters => 1.66 sec
time convert -size ${rad}x${rad} xc: -monitor \
-fx "xx=i-w/2; yy=j-h/2; rr=hypot(xx,yy); 2*rr/$rad" radius_rr.png
3 characters => 42 sec
time convert -size ${rad}x${rad} xc: -monitor \
-fx "xxx=i-w/2; yyy=j-h/2; rrr=hypot(xxx,yyy); 2*rrr/$rad" radius_rrr.png
4 characters => 42 sec
time convert -size ${rad}x${rad} xc: -monitor \
-fx "xxxx=i-w/2; yyyy=j-h/2; rrrr=hypot(xxxx,yyyy); 2*rrrr/$rad" radius_rrrr.png
10 characters => 43 sec
time convert -size ${rad}x${rad} xc: -monitor \
-fx "xxxxxxxxxx=i-w/2; yyyyyyyyyy=j-h/2; rrrrrrrrrr=hypot(xxxxxxxxxx,yyyyyyyyyy); 2*rrrrrrrrrr/$rad" radius_rrrrrrrrrr.png
Any chance this can be fixed.
I also want to point out that -fx does not allow alphanumeric characters, only alphabetic characters. Having a second numeral following an alphabetic character would allow some better loop scripting to set up variables for -fx.
Another feature that would be handy would be to allow -fx to access unix array elements. I tried this and it does not work.
Thanks for consideration of these enhancements.
Fred
I did some tests with command line IM 6.4.2-1 Q16 (non-hdri) and found that indeed -fx is an order of magnitude slower when variable names are more than 2 characters long. I think this is something that needs to be fixed for IM 7 if this is not a bug and can be fixed sooner.
Here are my tests in generating a radial gradient using rad=64
2 characters => 1.66 sec
time convert -size ${rad}x${rad} xc: -monitor \
-fx "xx=i-w/2; yy=j-h/2; rr=hypot(xx,yy); 2*rr/$rad" radius_rr.png
3 characters => 42 sec
time convert -size ${rad}x${rad} xc: -monitor \
-fx "xxx=i-w/2; yyy=j-h/2; rrr=hypot(xxx,yyy); 2*rrr/$rad" radius_rrr.png
4 characters => 42 sec
time convert -size ${rad}x${rad} xc: -monitor \
-fx "xxxx=i-w/2; yyyy=j-h/2; rrrr=hypot(xxxx,yyyy); 2*rrrr/$rad" radius_rrrr.png
10 characters => 43 sec
time convert -size ${rad}x${rad} xc: -monitor \
-fx "xxxxxxxxxx=i-w/2; yyyyyyyyyy=j-h/2; rrrrrrrrrr=hypot(xxxxxxxxxx,yyyyyyyyyy); 2*rrrrrrrrrr/$rad" radius_rrrrrrrrrr.png
Any chance this can be fixed.
I also want to point out that -fx does not allow alphanumeric characters, only alphabetic characters. Having a second numeral following an alphabetic character would allow some better loop scripting to set up variables for -fx.
Another feature that would be handy would be to allow -fx to access unix array elements. I tried this and it does not work.
Thanks for consideration of these enhancements.
Fred