i have a checkbox tree with ~40K items (5 level deep) representation of the files on the hdd.

it is very easy to save the selection, you ask the tree/datastore what is the selection and it gives you the data

how can i store that selection and later on load it (people may have added or removed nodes from the tree in the meantime)

currently i go through the tree elements and if it matched my saved info i enable it but that takes a very long time (and browsers hate long operation)

so any idea how to save and load a tree selection the most performant way? (lets say i selected 1K elements from a 40K elements tree)