SetActiveScalars function is too slow

Hi, I have unstructured data having tetrahedral cells in it. The data also contains 25 different scalar arrays in it. I am able to quickly switch(instantaneous update) between those scalar arrays in paraview, but when it comes to a vtk application written in python, it is too slow (takes ~4 seconds). My data has 2636203 cells in it and I am using SetActiveScalars function in vtk to switch between scalars. It still takes too long time to switch. How can I improve the scalar switching performance in vtk?

Switching between active scalars is a fast operation. I’m guessing that what’s happening is the VTK pipeline is executing due to the change in scalars. In ParaView, the pipeline may not execute until “Apply” is selected, so the cost of switching is deferred.