Skip to content

Memory Requirements

W. ❝Mac❞ McMeans edited this page Dec 25, 2023 · 25 revisions

👉🏻 View this page without sidebar

There is a difference between the memory required to store a key value and the memory consumed in the process. For JavaScript, consumption is doubled that of storage.

The following table illustrates memory storage and consumption, for both a key name and its value, as well as the available methods for determining each:

Prefix Example Key Value Key
Name
Key
Memory
Storage
keybytes
Full Key
Memory
Storage ⑴
keybytesall
Full Key
Memory
Consumed
keybytesmem
Data
Type
Data
Value
Internally
Stored As
Value
Memory
Storage
valbytes
Full Value
Memory
Storage ⑵
valbytesall
Full Value
Memory
Consumed
valbytesmem
lds-1. .set( 'skey1', '["x"]' ) skey1 5 bytes 11 bytes 22 bytes Array ["x"] ["x"]� 5 bytes 6 bytes 12 bytes
.set( 'skey1', 12n ) BigInt 12n 12� 2 bytes 3 bytes 6 bytes
.set( 'skey1', true ) Boolean true 1� 1 byte 2 bytes 4 bytes
.set( 'skey1', false ) Boolean false 0� 1 byte 2 bytes 4 bytes
.set( 'skey1', Date() ) Date ~ ZVRnbZS� ⑸ 7 bytes 8 bytes 16 bytes
.set( 'skey1', 2149.99 ) Float 2149.99 1w.14� ⑹ 5 bytes 6 bytes 12 bytes
.set( 'skey1', 9182736450 ) Integer 9182736450 1g]vJ(� ⑹ 6 bytes 7 bytes 14 bytes
.set( 'skey1', null ) null null null� 4 bytes 5 bytes 10 bytes
.set( 'skey1', {'a':1} ) Object {'a':1} {'a':1}� 7 bytes 8 bytes 16 bytes
.set( 'skey1', 'lds' ) String 'lds' lds� 3 bytes 4 bytes 8 bytes
.set( 'skey1', 'this is some string data' ) Compressed
String
'this is some string data' \x9B8\x17³l>ÃF¥'þa� ⑷ 17 bytes 18 bytes 36 bytes ⑶



Footnotes:
⑴ includes the namespace prefix (6 bytes, in this example)
⑵ includes the data type marker flag (always 1 byte)
⑶ text compression—even on a small scale—makes an impact (uncompressed this string consumes 24 bytes, not 17)
⑷ note that string length is inconsequential (13 in this case); for storage the only metric that counts is byte count
⑸ dates are automatically stored compressed, providing a degree of obfuscation as well
⑹ numbers (floats and integers) are automatically stored compressed, providing a degree of obfuscation as well

localStorage Keys

The usual suspects:

set / get      clear      key      remove

The esoteric ones:

Array Keys:
push / pull, pullall      poke      contains      where

Broadcasting:
broadcast

Bypass:
forceset / forceget

Data Transfer:
import / export

Duplicates:
countdupes, showdupes, listdupes

Internals:
cancrunch      crunch / uncrunch

shufflestring / unshufflestring

xorstring

Management:
keys

Memory Consumption:

Memory Quota:
showquota

Query:
haskey, hasval, hastype

Security:
safeset / safeget

setscramblekey / getscramblekey

Type Check:
isarray      isbigint      isboolean      iscrunch

isdate      isfloat      isinteger      isnull

isnumber      isobject      isstring

showtype

Utility:
chopget      copy      softset      rename

Properties:

channel      length      quota      version

Settings:

verbosity

Memory Keys

Standard:

_set / _get      _clear      _key      _remove

Unconventional:

Data Sync:
_backup / _restore

Management:
_keys

Security:
_safeset / _safeget

Type Check:
_isarray      _isbigint      _isboolean      _iscrunch

_isdate      _isfloat      _isinteger      _isnull

_isnumber      _isobject      _isstring

_showtype

Utility:
_chopget      _copy      _softset      _rename

Clone this wiki locally