I have a program where I have an input feed (via ZMQ) that constantly updates an Array to maintain current state. I have other processes (either separate Tasks via @async or maybe on other threads via multithreading, still a design choice in flux) which will need to periodically access the most current state of this array.
My current design simply maintains this State Array as a global variable, and copies it for each task that is generated to process state. I was reading through the performance tips about not using global variables, but I am not seeing any other way to structure the program. This seems like it must be a pretty common design pattern, though, so I was wondering if there is a better approach to solving this problem in more performant way? Performance, in this context, means doing the calculations with the most current State as fast as possible.