Re: The simple command x=0;Dynamic[x=x+1]

*To*: mathgroup at smc.vnet.net*Subject*: [mg124876] Re: The simple command x=0;Dynamic[x=x+1]*From*: Fred Simons <f.h.simons at tue.nl>*Date*: Fri, 10 Feb 2012 05:55:21 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*References*: <20122716396.398638@jfultz3winlap>

Dear John, Many thanks for your reaction. Your postings are always worth to be studied carefully. My idea was that updating happens at a speed of about 20 times per second, but that seems to be incorrect. It turns out to be much higher. You give a nicely detailed description of the updating cycle, together with the question: > Where are you getting "20" from? What is it that updates at that speed? You've > completely lost me here. Well, that factor 20 is mentioned in the tutorial Advanced Dynamic Functionality. After the description of the updating mechanisme, slightly less detailed than the one in your post, it continues: By default, dynamic outputs triggered by changes in variable values are updated no faster than twenty times per second (this rate can be changed with the SystemOption "DynamicUpdateInterval"). When I read this for the first time, already a long time ago, I did a little test by counting the number of updates and comparing them with the total time: In[46]:= ctr=0; Dynamic[ctr=ctr+1;j, TrackedSymbols:>{j}] j=0; While[j<10^6, j=j+1] // Timing ctr Out[47]= 1000000 Out[48]= {1.342,Null} Out[49]= 22 This result was close to what I expected: about 20 times per second. However. now I see that the fact that this test resulted in a speed of 20 updates per second was pure luck. If I had done this test only slightly different, for example with a Do-loop instead of a While-loop, I would have been puzzled already then. Or when I would have changed the DynamicUpdateInterval to 10 updates per second: In[41]:= SetSystemOptions["DynamicUpdateInterval"->0.1];ctr=0; Dynamic[ctr=ctr+1;j, TrackedSymbols:>{j}] j=0; While[j<10^6, j=j+1] // Timing SetSystemOptions["DynamicUpdateInterval"->0.05]; ctr Out[42]= 1000000 Out[43]= {1.591,Null} Out[45]= 954 So at the moment it is this paragraph in the tutorial and the meaning of DynamicUpdateInterval that confuses me. Am I right in my understanding of your description of the update cycle that when the frontend is informed by the kernel that a variable (in a displayed Dynamic, of course) needs updating, that is seen by the frontend as a signal that the the screen has to be redrawn? Once again many thanks, Fred Simons Eindhoven University of Technology