Manipulate is sluggish?
- To: mathgroup at smc.vnet.net
- Subject: [mg83632] Manipulate is sluggish?
- From: Tom Burton <news at brahea.com>
- Date: Mon, 26 Nov 2007 03:48:54 -0500 (EST)
Forgive me if this issue has been addressed.
I'll soon need to work in CMYK colors and also will want to use the
new Manipulate expressions to visualize functions of 4 and 5
variables. I decided to try a bit of both, first defining a
conversion from CMYK to RGB,
cmyk2rgb[c_,m_,y_,k_]:=(1-k){1-c,1-m,1-y}
and then comparing the two color systems:
Manipulate[GraphicsGrid[Table[c=xx/12;m=yy/12;Graphics[{CMYKColor
[c,m,y,k],Disk[{xx,yy},1,{0,\[Pi]}],RGBColor@@cmyk2rgb[c,m,y,k],Disk
[{xx,yy},1,{\[Pi],2\[Pi]}]},ContentSelectable->False],{xx,0,12,2},{yy,
0,12,2}]],{y,0.0,1,1/6},{k,0.0,1,1/6}]
The expression above lays out a grid in cyan and magenta, with yellow
and black controlled by sliders. If my conversion algorithm is
wrong, corrections are welcome but beside the point I'm trying to
make, which is that the resulting dynamic graphic is sluggish and shy
on both my G4 dual 1G and my MacBookPro dual 2.3G. Response is so
slow that animation is always out of sync. After I manually move a
slider, sometimes I need to scroll the graphic completely off the
page and/or (???) focus on another cell in order for the graphic to
update. In other words, it won't update while I look at it (shy!).
The kernel will toil away at 90+% of one CPU indefinitely until I
scroll away and do something else. This behavior makes the graphic
nearly useless. It seems not to matter whether I use continuous
sliders, discrete sliders, or drop-down lists of fixed values.
It's annoying to compare this sluggishness with the speed of the
corresponding movie in version 5.2:
Flatten[Table[
Show@GraphicsArray[
Table[c=xx/12;m=yy/12;
Graphics[{CMYKColor[c,m,y,k],Disk[{xx,yy},1,{0,\[Pi]}],
RGBColor@@cmyk2rgb[c,m,y,k],Disk[{xx,yy},1,{\[Pi],2\
[Pi]}]},
AspectRatio\[Rule]1],{xx,0,12,2},{yy,0,12,2}],ImageSize\
[Rule]500,
PlotLabel\[Rule]ToString[{y,k}]],{y,0.,1.01,1/6},{k,
0.,1.01,1/6}]]
This is not as slick and convenient as Manipulate in version 6, but
it's so much faster! Does anyone else see this sluggishness and
shyness? More importantly, can I work around it somehow? By the way,
the speed of graphics itself seems not to be the issue. The following
composite graphic of all slider settings is computed and displayed a
few seconds:
GraphicsGrid[Table[GraphicsGrid[Table[c=xx/12;m=yy/12;Graphics
[{CMYKColor[c,m,y,k],Disk[{xx,yy},1,{0,\[Pi]}],RGBColor@@cmyk2rgb
[c,m,y,k],Disk[{xx,yy},1,{\[Pi],2\[Pi]}]}],{xx,0,12,2},{yy,0,12,2}]],
{y,0.,1.01,1/6},{k,0.,1.01,1/6}],ImageSize->800]
Thanks in advance,
Tom
When responding, please replace news with my first initial and full
last name, as one word.
Tom Burton