Read all packet table data at once from packet table


I am using HDF5 build 1.8.5 and developing an application with packet table
in hdf5 file.

I have created a C library which manages reading and writing to this packet
table in hdf5 file.

I have a C# wrapper which uses this library to perform the above operations.
While working with

this application, I observed that the reading all records from packet table
takes more time as

there are more records in the packet table.

My C code is as:

bool status = H5PTread_packets(ptable, start, nRecords, readBuffer);

Record / Structure definition in C Library:
typedef struct
{ int var1; int var2; unsingned int var3;}MyStruct;

C# code:
bool ReadRecods(IntPtr data, int start, int nRecords); // Managed method

Record / Structure definition in C#:
public strcut MyStruct
     Int32 var1; Int32 var2; UInt32 var3;

// Method calling 'C library function
          int sizeOfRecords = (int)nRecords *
          IntPtr ptrListStructs = Marshal.AllocHGlobal(sizeOfRecords);
          ReadRecords(ptrListStructs, start, (int)nRecords); // ---> Takes
more time than the 'BinaryReader' to read .txt file having data of same

         // This 'for' loop also induces more time as I need to pull off
individual structures
         int size = Marshal.SizeOf(typeof(MyStruct));
         List<MyStruct> listMyStructs = new List<MyStruct>()
         for (int elOfInterest = 0; elOfInterest < (int)nRecords;
                 IntPtr elIndex = new IntPtr(ptrListStructs .ToInt64() +
size * elOfInterest);

Let me know how I do this in more efficient way and reduce time to read the
records from packet table.


Best Regards,
View this message in context:
Sent from the hdf-forum mailing list archive at