Fastest way to create 3D topography surface (with holes)

In Python plugin I use the code below to create 3D polydata from reqular 2D grid with holes (NoData values) but it’s works too slow. Maybe should I use some other data type or processing instead?

# Define points and triangles for mesh
vtk_points = vtkPoints()
vtk_cells = vtkCellArray()

# Build the meshgrid manually
count = 0
# iterate array
for j in range(0,len(ys)-2):
	for i in range(0,len(xs)-2):
		# check area
		if not mask[j,i] or not mask[j+1,i] or not mask[j,i+1] or not mask[j+1,i+1]:

		# Triangle 1
		vtk_points.InsertNextPoint(xs[i],   ys[j],   values[j,i])
		vtk_points.InsertNextPoint(xs[i],   ys[j+1], values[j+1,i])
		vtk_points.InsertNextPoint(xs[i+1], ys[j],   values[j,i+1])

		triangle = vtkTriangle()
		triangle.GetPointIds().SetId(0, count)
		triangle.GetPointIds().SetId(1, count + 1)
		triangle.GetPointIds().SetId(2, count + 2)


		# Triangle 2
		vtk_points.InsertNextPoint(xs[i],   ys[j+1], values[j+1,i])
		vtk_points.InsertNextPoint(xs[i+1], ys[j+1], values[j+1,i+1])
		vtk_points.InsertNextPoint(xs[i+1], ys[j],   values[j,i+1])

		triangle = vtkTriangle()
		triangle.GetPointIds().SetId(0, count + 3)
		triangle.GetPointIds().SetId(1, count + 4)
		triangle.GetPointIds().SetId(2, count + 5)


		count += 6

# Create a polydata object
trianglePolyData = vtkPolyData()

# Add the geometry and topology to the polydata

Can you share an input data and the desired output ?

Source datasets:

Download the global GEBCO_2019 Grid - in netCDF format (11 Gbytes, 12 Gbytes uncompressed)

Admin 0 – Countries - Download without boundary lakes

Actual plugin code to generate vtkUnstructuredGrid with Z coordinate for coloring:

And to add attribute to it (like to country name for coloring and labeling):

This is the output:

For now, I don’t know more optimal way to get produce this visualization. Is it the optimal datatype for the task? We have Z coordinate in the mesh geometries and as the separate attribute - could we exclude it but still have the ability for mesh coloring by Z coordinate? Could we save additional attribute like to country name by more optimal way (for now it’s saved separately for every cell as I see)?