Closed kota65535 closed 8 years ago
Each packets are composed of header, whose size is 136Bytes, and payload, whose size is about 60KB(jpeg image). At first I defined Record class that represents the whose that packets, but when I run my program It takes over 10 seconds to instantiate one record.
Let me guess, you're defining the payload as an array of :uint8
? This will cause many thousands of objects to be created which is why it is slow to instantiate.
If you define the payload as a single :string
it should be much faster.
Exactly! Now I defined my Record class with payload as :string, and Everything goes well. Thank you very much!
It may be not appropriate to ask the question like this here...
I'm working with streaming packets that contains jpeg images. Each packets are composed of header, whose size is 136Bytes, and payload, whose size is about 60KB(jpeg image). At first I defined Record class that represents the whose that packets, but when I run my program It takes over 10 seconds to instantiate one record.
Should I redefine Record class which is composed of only the header part of the packets?