In exploring Working with DynamicModule: Tracking the progress of Initialization, I came across this. The following usually shows a value for x of 300000 to 400000 after initialization. It varies each time.
DynamicModule[{x}, Dynamic[x], Initialization :> (x = 1;
Do[x = i, {i, 10000000}];
x = 2;
Do[x = i, {i, 10000000}];
x = 3;)]
If the option SynchronousInitialization -> True is set, a similar thing happens, although the displayed value for x ranged from 18000 to 9900000. On the other hand, if SynchronousInitialization -> False is set, the displayed value is 3, as expected.
Is this a bug, or is it to be expected, due to some aspect of the dynamic updating system I'm not aware of?
Version: 10.0.0, 9.0.1, and 8.0.4; Max OSX 10.9.4.
Pause[1]. This morning it's taking 2.6 sec. and the complete initialization code on its own takes 5.3 sec. If I putSessionTime[]in cells before and after theDynamicModule, the difference is slightly over 6 sec. I knew about the time constraint, but thought I was within that time. I must have been mistaken last night about the timing of the loop. I also thought there would be a warning if it timed out. – Michael E2 Sep 18 '14 at 11:34