UUIDs are basically hexadecimal representation of a 128-bit integer value, in the 8-4-4-4-12 format. As you can see this is VERY inefficient: 16 bytes encoded into 36 characters (= 36 bytes in ASCII, but can be much larger in Unicode depending on the encoding used).
Many scripters have shared functions that compacts the UUID into a much shorter string, in the objective of saving space in the script and/or in Linkset Data. But the functions they have shared are invariably quite sizable, thus actually eating into available memory for the script.
This issue can be alleviated by providing 2 functions dedicated to encoding UUIDs in a different way:
(1)
string llEncodeUUID(key uuid)
=> provides a Base64-encoded UUID. This shortens the UUID from 36 characters into just 22 characters.
(2)
key llDecodeEUUID(string euuid)
=> decodes a 22-character Base64-encoded UUID into a 'proper' 8-4-4-4-12 UUID. If
uuids
is not 22-character or does not decode into a proper UUID, then just return the NULL key.
Providing these 2 functions will save a great deal of memory, both within the script, and in Linkset Data.
Since this will be implemented in the back-end, a more efficient encoding might be used. Say, Base85/Ascii85; this will further 'compress' the UUID from 36 characters to just 20 characters. Or any other encoding. Basically, the "Encoded UUID (euuid)" can be left opaque. What's important: (1)
the length of the euuid must be constant
, (2) 1 or more characters in the ASCII 32~127 range must not be used (preferably the space / ASCII 32), and (3) the following relation holds:
llDecodeEUUID(llEncodeUID(a_key)) == a_key