# Some speeding up with dynamic images

When I was browsing some of the old code, I came across this

r := .5-Random[];
p = Array[{8^9 {r,r},r+.5}&, 99];

Dynamic @ Graphics[
Disk @@@ (
p = { #2#1 + {r, r} + (1-#2) MousePosition["Graphics",#1], #2
}& @@@ p
)
, PlotRange->44
]


which should be 99 random disks moving towards the position of the mouse. But it lags a lot and I suppose the fps~5 or so. I thought that this couldn't be so slow always, so I grabbed a copy of Mathematica 7-the version when this code was written. Not surprisingly , it was much faster. Why? What should I do to let my version 11.3 run this as fast as the older versions?

Here is one way:

r := .5 - Random[];
p = Array[{8^9 {r, r}, r + .5} &, 99];

• @t-smart it simplifies updating flow. No matter what kernel updates p each .05 s. With an intermediate call for MousePosition. In your approach MousePoistion is tracked by Kernel but it needs to know it from FrontEnd and when updating happens then the tracking is confused because FE can't provide the value as Dynamic works on preemptive link etc etc, so it is a little bit messy, – Kuba Apr 24 '18 at 9:37