Right, like Thorsten said: 500+ property updates (polling) would surely show up - especially given that a few years ago, that was pretty much the load caused by the whole simulator per frame. So it will be interesting to see if/how the complexity of these instruments is adding up (or not).
But all the sprintf/getprop-level overhead that is accumulating through update() loops invoked via timers would be straightforward to reduce significantly (or even eliminate) by extending CanvasElement/CanvasText so that it supports labels in the form of sprintf format strings that are populated by using a property node (sub-tree), which would mean that there would be zero Nasal overhead for those labels/nodes that can be expressed using static format strings and a fixed set of dynamic properties.
All the polling could be prevented then, and updating would be moved to C++ space.
We ended up using a similar approach when we noticed that drawing taxiway layers would create remarkable property overhead, so that we troubleshooted the whole thing, at which point, TheTom added helpers to further reduce system/Nasal load
sanhozay wrote in Sat Dec 19, 2015 9:59 pm:What are the rules for thread safety when reading/writing the property tree from multiple threads in Nasal?
FlightGear's main loop is primarily single-threaded, most of its subsystems were not added/maintained with thread-safety in mind.
Nasal is in fact the only component intended to be threadsafe - however, that does not apply to the FlightGear integration layer (extension functions/APIs).
Thus, you are in uncharted waters basically
Which is to say that you generally want to avoid using threads and only consider them a tool for exploring alternate solutions.
However, worker threads can access arbitrary Nasal data structures using the threads module and its helpers for synchronization.
So you would be "safe" to do background processing using worker threads, e.g. for calculations - as long as you don't access any FG specific extension functions, which includes timers, listeners etc