Re: [dev] Best way to serialize data

From: Connor Lane Smith <cls_AT_lubutu.com>
Date: Mon, 6 Jun 2011 20:18:20 +0100

On 6 June 2011 20:07, Džen <yvldwt_AT_gmail.com> wrote:
> I wonder, which method would need more cpu time? I suppose that when
> using delimiters there isn't a easier way than using fgetc(), reading
> through the whole data stream. Hard-coded field lengths would be faster
> if the fields contain a lot of characters I guess.

Again, it's about the use case. For small fields you probably don't
have to worry about reading inefficiencies, so use delimiters. For
large fields use fixed-length or length-prefixed, for the reasons I
mentioned. These two approaches are both easy to write, one is just
faster to seek to the nth item, and the other is more compact,
respectively.

cls
Received on Mon Jun 06 2011 - 21:18:20 CEST

This archive was generated by hypermail 2.2.0 : Mon Jun 06 2011 - 21:24:03 CEST