On Dec 2, 2:44 am, Jakub Łopuszański <jakub.lopuszan...@nasza-
klasa.pl> wrote:
> What is the reason you pad numbers with spaces when decrementing? Is it for
> performance? It seems to me that it happens only once per say 10^n times, so
> we could afford reallocation of memory even for n=1. But even if I am wrong,
> why not just pad it with \0 ? That would make life much easier.
> Alternatively you could just move the content to the right, pad it from left
> with whatever you like (even spaces) but at the same time move the pointer
> one position to the right.

  Mostly, it's always been this way.  It's not a protocol requirement,
but the protocol tells you to expect that.  Changing the padding to a
different character would just cause all existing clients to see data
that's unexpected.  Not every client is written for languages that
represent strings as 0-terminated sequences, for example.

> This "feature" combined with Memcache client for PHP and crappy PHP type
> coercions results with bugs very difficult to track (on average once per
> each hired developer despite the training).

  Can't you just fix your PHP client once?  If the value is expected
to be numeric, then it should just do the right thing when you
retrieve it, right?

> I mean: this is an internal hack/tweak/optimization and should be
> transparent to the end user. I know it is documented, but it doesn't make it
> more reasonable.

  I don't believe it does the same padding in the engine branch.  That
does mean it's likely slightly slower, but I believe that was
necessary for some bug fixes.

Reply via email to