slow read file

Hi,

when reading a 6Gb binary file (only header is text) it takes approx 98 seconds which seems slow withis code:

if data_structure == 'STRUCTURED_POINTS': reader = vtk.vtkStructuredPointsReader() # here you can add other readers in case
  
    t0 = time.time()
    reader.SetFileName(os.path.join(self.address,tar_file+'.vtk'))
    t1 = time.time()
    print('DEBUG: SetFileName',t1-t0)
    reader.ReadAllVectorsOn()
    t2 = time.time()
    print('DEBUG: ReadAllVectors v2 (Vector)',t2-t1)
    reader.Update() # un peu lent
    t3 = time.time()
    print('DEBUG: Update',t3-t2)

output:

DEBUG: SetFileName 5.9604644775390625e-06
DEBUG: ReadAllVectors v2 (Vector) 7.867813110351562e-06
DEBUG: Update 98.01152896881104
DEBUG: GetOutput 0.0011713504791259766

is it normal?
is there a way to speed up that?

opening the file in Emacs or Vim take approx. 1 minutes,copying it 15 seconds…

regards,

Damien

It’s called a legacy file format for a reason :-). I suggest you use the appropriate XML readers to start (vtkXMLImageDataReader). There are probably other image data readers as well that may be faster / better suit your application needs.

Or you can also use VTKHDF format: VTK File Formats - VTK documentation