My program has an openGL rendering thread and a data modification thread. The rendering thread accesses the data in a gaggle of ArrayLists, while the data modification thread alters, removes, and adds objects to the ArrayLists. The threads update about 60 times per second, and the ArrayList manipuation is the program’s bottleneck. I’ve tried synch blocks (super slow), CopyOnWriteArrayLists (quite slow), and creating buffer ArrayLists in the rendering thread (lesser of three evils). What’s the ‘best’ way to get maximum efficiency out of concurrent ArrayLists?
My program has an openGL rendering thread and a data modification thread. The rendering
Share
The best mechanism is to do your work in the GL thread and queue operations to be executed. If there is only ever one thread accessing the list, there is no problem.