List glitch on large updating dynamic list

SparksMaths shared this problem 2 weeks ago
Not a Problem

I have an issue with a large (>800 element) list simply disappearing during animation.

I am trying to present a dynamic list showing the results of a simple trial with p chance of success. I'm animating the outcome by animating a slider "aa" and using the OnUpdate script which forces a refresh to randomise, and appends the latest running average to a list. This lets me plot the history of the average as the experiments continue, even as I change the graph scale

(I could trace a single point, but as soon as the zoom level changes it would vanish).


Obviously I know I'm taxing the list handling procedures when it gets large...

In Classic 5.0.593.0-d on Windows 10 the list almost always just vanishes when I hit around 850ish trials (hard to be precise).

When uploaded it the simulation freezes at 868 trials. It still lets me add single trials, but the "run 1000 trials" does nothing.

On Classic 6.0.588.0 it froze at 647 trials or so. List does not vanish. Similar behaviour to online.


Am I simply hitting memory limits for list handling?

This is happening in a few other of my 'simulation' type files where I generate large lists. It can be very frustrating as the complicated list object can suddenly vanish, and I can't undo to get it back, leaving me with no option other reloading the file (if I saved it recently!) or rebuilding.


Advice appreciated.


Online versionhttps://www.geogebra.org/m/mxr9pcvt

also ggb file attached.

Comments (5)

photo
2

I think it will be more efficient to use the first syntax here, then you can reduce the number of lists/objects

https://wiki.geogebra.org/e...


... and you can run with more memory if you need :) https://wiki.geogebra.org/e...

photo
2

Am I simply hitting memory limits for list handling?
Yes

AlgoZip aborted: free memory reached 102208

photo
2

Oh, I think this is a big problem too

SetValue(listavs,Append(listavs,runav))
You should use SetValue( <List>, <Number>, <Object> ) to add a number to the end of a list

https://wiki.geogebra.org/e...

photo
2

UpdateConstruction() is very wasteful for updating a single random number, you can do

SetValue(a, random())

or if you have eg a=RandomBetween(1,10+0dummy) then

SetValue(dummy, 0)

will update it

photo
1

Super helpful advice on all fronts. Thank you. Glad that you've answered my question (Yes, it's a memory issue!) and that you've suggested much better practice on how to implement this sort of thing effectively. Will be upgrading this file (and several others)...


:)

© 2020 International GeoGebra Institute