Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dynamic performance - input fields slow

15 views
Skip to first unread message

nona...@gmail.com

unread,
May 25, 2009, 6:13:03 AM5/25/09
to
Hello,

I'm writing a Dynamic module with 3D graphics and several input
fields. Once the 3D plot is rendered, simply typing in the input
fields become extremely slow (even though the graphic is not
changing).

Here's a simple example:

DynamicModule[{f, g},
{InputField[Dynamic[f], FieldSize -> 10],
InputField[Dynamic[g], FieldSize -> 10],
Dynamic[Plot3D[f, {x, -2, 2}, {y, -2, 2}]]
}
]

Initially, both input fields respond quickly to typing. If I enter
something in the first, like x, then the plot shows, and the input
fields no longer respond quickly to typing. If I do the same thing
with Manipulate, I don't experience this problem:

Manipulate[
Plot3D[f, {x, -2, 2}, {y, -2, 2}],
{f}, {g}]

I would like to use Dynamic rather than Manipulate because the
eventual UI will be quite a bit more complicated, but I'm not sure
what's causing the slow performance. Does anybody have any tips?

Thanks!

David Park

unread,
May 26, 2009, 5:19:02 PM5/26/09
to
When I copy your DynamicModule example into a fresh notebook, I don't
experience any problem with slow response to typing before or after the plot
is rendered.


David Park
djm...@comcast.net
http://home.comcast.net/~djmpark/

David Park

unread,
May 26, 2009, 7:45:26 PM5/26/09
to

Sjoerd C. de Vries

unread,
May 27, 2009, 5:05:04 PM5/27/09
to
I don't seem to have this problem. Perhaps something you entered
that's causing the problem?

Cheers -- Sjoerd

nona...@gmail.com

unread,
May 28, 2009, 4:26:51 AM5/28/09
to
Interesting; when I copy it to a fresh notebook in a new session of
Mathematica, I have the same problem. Perhaps it's just because my
computer is old and slow. However, I tried it on a different
computer, and I experience the same issue if I make the graphics
complicated enough.

For example:

DynamicModule[{f, g},
{InputField[Dynamic[f], FieldSize -> 10],
InputField[Dynamic[g], FieldSize -> 10],

Dynamic[Plot3D[f, {x, -2, 2}, {y, -2, 2}, PlotPoints -> 250],
TrackedSymbols -> {f}]}
]

has noticeably slower response in the input fields as compared to

Manipulate[
Plot3D[f, {x, -2, 2}, {y, -2, 2}, PlotPoints -> 250],
{f}, {g}]

It appears to me (although this is just a guess) that the Dynamic
version tries to redraw the graphics each time I type in an input
field, whereas the Manipulate version does not. Any idea what
Manipulate does to get this behavior?

By the way, I'm using Mathematica 6, if it makes a difference.

On May 26, 5:19 pm, "David Park" <djmp...@comcast.net> wrote:
> When I copy your DynamicModule example into a fresh notebook, I don't

> experience any problem with slow response to typing before or after the p=
lot
> is rendered.
>
> David Park
> djmp...@comcast.nethttp://home.comcast.net/~djmpark/

0 new messages