[dev] [cvs] commit: horde/admin alarms.php horde/docs CHANGES kronolith/docs CHANGES kronolith/lib Driver.php nag/docs CHANGES nag/lib Driver.php mnemo/docs CHANGES mnemo/lib Driver.php turba/docs CHANGES turba/lib Driver.php framework/MIME MIME.php ...

Chuck Hagenbuch chuck at horde.org
Thu Aug 30 04:53:33 UTC 2007


Quoting Michael M Slusarz <slusarz at horde.org>:

>>   Log:
>>   [cjh] Fix generation of UIDs with PHP 5.2+.
>
> 1. I thought uniqid() was terribly slow.

Benchmarks? Feel free to replace it with sufficient padding.

> 2. These new generated IDs are twice the size of the old IDs - mainly
> because the new IDs are limited to 16 bytes while the old IDs used 36
> bytes and thus could pack the same amount of information into a
> smaller string (technically we could use any ASCII printable character
> to compact the ID even more...)  Again, not a big deal when looked at
> singly but imagine a system with millions of users with millions of
> Message-IDs - these IDs are now going to take up a not insignificant
> larger chunk of storage.

The old ids were never longer than 12 characters. These provide a full  
16, which the original algorithm seemed to want because it was asking  
for the last 16 characters of the base_convert(microtime(..))  
construct. I just added uniqid as a padding to make sure we had 16  
characters before picking the last 16.

So... feel free to improve this, but the fact that were were taking  
the last 16 characters of a 12 character string meant that in PHP  
5.2+, we were getting _nothing_.

-chuck


More information about the dev mailing list