These forums are CLOSED. Please visit the new forums HERE
Library: Packing and Unpacking Keys into Integers |
|
|
Emma Nowhere
Registered User
Join date: 15 Aug 2006
Posts: 29
|
09-24-2007 15:29
Code removed to make sure no one inadvertently uses this technique
|
|
Bobbyb30 Zohari
SL Mentor Coach
Join date: 11 Nov 2006
Posts: 466
|
11-03-2007 05:37
very useful
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-03-2007 08:50
Oh nice, why didn't I think of that... I think that just doubled my storage capacity, extended my storage time before dump, AND shrank my effective size for regular dumps... may need to rewrite for speed, or out process... but yes thanks a bunch
_____________________
|
| . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - |
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-03-2007 09:26
Yumi has something similiar here:
/15/84/72058/1.html And an extremely small one from Giggs Taggart: http://www.lslwiki.net/lslwiki/wakka.php?wakka=Example32BitHash _____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum |
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-03-2007 10:20
Yumi has something similiar here: /15/84/72058/1.html And an extremely small one from Giggs Taggart: http://www.lslwiki.net/lslwiki/wakka.php?wakka=Example32BitHash o/ did anyone ever tell you, 'you're my hero'..... o/ _____________________
|
| . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - |
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
11-03-2007 11:52
Actually, a list of 4 integers takes up more memory than a key.
A key takes up 54 bytes of memory, a list of 4 integers takes up 60 bytes of memory. Source: http://www.lslwiki.net/lslwiki/wakka.php?wakka=MemoryUsage |
|
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
|
11-03-2007 12:23
Actually, a list of 4 integers takes up more memory than a key. A key takes up 54 bytes of memory, a list of 4 integers takes up 60 bytes of memory. Source: http://www.lslwiki.net/lslwiki/wakka.php?wakka=MemoryUsage I love LSL. _____________________
![]() |
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-03-2007 16:34
::looks at overhead values:: o.0 OMFG mystery my $%^ that's just insane
ok so the above example is a no go.... but the idea is viable for higher base numbers and strings... anyone feel like coding a base64 conversion routine? I doubt I'll get around to it anytime soon _____________________
|
| . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - |
|
Emma Nowhere
Registered User
Join date: 15 Aug 2006
Posts: 29
|
11-08-2007 13:56
Yes, this technique does not work to reduce memory usage and shouldn't be used due to the fact that LSL stores an integer as 10 to 15 bytes rather than the expected 4 bytes. Amazingly, one could actually store an array of integers as hex strings and have them be smaller, which boggles the mind.
|
|
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
|
11-08-2007 14:19
It's still useful if you need to pass keys in cases where you can't use strings.
_____________________
![]() |
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
ok, so this is how it SHOULD have worked
11-09-2007 03:05
ok so this bugged me a bit so I decided to write a base 64 converter for keys.... pretty fast if I don't say so myself....
CODE
please note that this set of functions uses 827 bytes by itself... so you won't see your first byte of savings till storing your 92nd key, if it's in the same script... after that it's a 25% savings guaranted.. or you could offload to another script to reap the full benefits (minus the extra link msg code) sooner... yes I COULD have transcoded directly from base 64 back to base 16, but A) it seemed like more work, B) using the built in 64toInt seemed faster, C) I'm lazy, D) all of the above also note since strings take up less space in lists, the same concept could be applied to large integer or float lists, for space savings of ~60% after the second item (minus overhead for code), IF you put them in one huge string... but since parsing huge strings in lsl is a bit painful I'm told, it may not be a good option... but it may even be workable for other variable type (vetors, rotations) if storing a lot of them in a list... if I can make it feasible I'll post them all combined as a library entry with comments ![]() _____________________
|
| . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - |
|
Stephen Zenith
Registered User
Join date: 15 May 2006
Posts: 1,029
|
11-09-2007 03:16
Base64 is very useful if you need to pass lots of integer data around using systems with limits on the data length. Think maximum length of a chat message, maximum size of a http request, etc.
_____________________
|
|
Bobbyb30 Zohari
SL Mentor Coach
Join date: 11 Nov 2006
Posts: 466
|
12-03-2007 08:57
Actually, a list of 4 integers takes up more memory than a key. A key takes up 54 bytes of memory, a list of 4 integers takes up 60 bytes of memory. Source: http://www.lslwiki.net/lslwiki/wakka.php?wakka=MemoryUsage Lol _____________________
|
|
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
|
12-04-2007 12:46
Actually, a list of 4 integers takes up more memory than a key. A key takes up 54 bytes of memory, a list of 4 integers takes up 60 bytes of memory. Source: http://www.lslwiki.net/lslwiki/wakka.php?wakka=MemoryUsage Doh! All that coding for naught! lol |
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
12-04-2007 19:36
Code removed to make sure no one inadvertently uses this technique don't be so down about it, it still has uses... that's the nice thing about code, sometimes the intended use, isn't the best use _____________________
|
| . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - |
|
Ollj Oh
Registered User
Join date: 28 Aug 2007
Posts: 522
|
12-26-2007 06:14
I enhanched some code to store 15 bits in one UTF8 unicode symbol (encoding much faster than decoding).
A 16th "sign"-bit can be "1" if 5 other bits are all "0" (or just 4 other bits are all "0"with one more condition). A description of a prim (and any string) can store 84 of those (and more, but than it loses its ability to be rezzed (but not the ability to be copied inworld). I for one welcome (a little more than) 15*84=1260 bits of transferable data (in one string). Thanks to this thread I got the snips to read hexadecimals (and 5bit'ers) quickly into integers. So, who wants the code to transfer 7 UUIDs IN ONE STRING of 84 UTF8 symbols (plus an 8 more fragmented UUID) ? |
|
Alexandri Ashbourne
Registered User
Join date: 26 Mar 2008
Posts: 4
|
04-11-2008 08:07
I think the original code should have remained in this topic and perhaps simply add a disclaimer if it does not work for it's intended purpose. There may very well be other uses which could be very beneficial for other reasons, such as simplifying or reformatting keys to be sent for script linking or say/listen relations between scripts/objects.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
04-11-2008 11:34
Note that the character limits for object names and descriptions may have been reduced since some of the above comments were made. For example, you now cannot set an object name/description via script to a longer value than is saved when the object is taken into inventory.
|