On Aug 3, 2007, at 0:59, A. Pagaltzis wrote:
* Peter da Silva <pe...@taronga.com> [2007-08-02 21:45]:
 Please have the length of strings upfront.

Length encoding isn't self-syncing,

Synching the length is O(1).

Can you elaborate on that comment, because I don't see how you can in principle resync a stream of length-prefixed records without any sentinel values. And if you have sentinels you're back where you started.

So what? Just make sure the counter is wide enough for any string
you can keep in memory.

Stream data is not limited to the size of memory.

That C and UNIX immortalised zero-terminated strings amounts to a
crime if you consider the amount of CPU cycles that have since
been wasted scanning for NULs.

In this situation, you're reading a stream anyway. You have to touch every byte as it comes in.

Reply via email to