diff --git a/config/config-options/DUK_USE_HOBJECT_ARRAY_ABANDON_LIMIT.yaml b/config/config-options/DUK_USE_HOBJECT_ARRAY_ABANDON_LIMIT.yaml new file mode 100644 index 00000000..74b83878 --- /dev/null +++ b/config/config-options/DUK_USE_HOBJECT_ARRAY_ABANDON_LIMIT.yaml @@ -0,0 +1,14 @@ +define: DUK_USE_HOBJECT_ARRAY_ABANDON_LIMIT +introduced: 2.1.0 +default: 2 +tags: + - performance + - lowmemory +description: > + Abandon array part if its density is below L. The limit L is expressed as + a .3 fixed point point, e.g. 2 means 2/8 = 25%. + + The default limit is quite low: one array entry with packed duk_tval is 8 + bytes whereas one normal entry is 4+1+8 = 13 bytes without a hash entry, + and 17-21 bytes with a hash entry (load factor 0.5-1.0). So the array part + shouldn't be abandoned very easily from a footprint point of view. diff --git a/config/config-options/DUK_USE_HOBJECT_ARRAY_FAST_RESIZE_LIMIT.yaml b/config/config-options/DUK_USE_HOBJECT_ARRAY_FAST_RESIZE_LIMIT.yaml new file mode 100644 index 00000000..6429d4bb --- /dev/null +++ b/config/config-options/DUK_USE_HOBJECT_ARRAY_FAST_RESIZE_LIMIT.yaml @@ -0,0 +1,13 @@ +define: DUK_USE_HOBJECT_ARRAY_FAST_RESIZE_LIMIT +introduced: 2.1.0 +default: 9 +tags: + - performance + - lowmemory +description: > + Skip abandon check in object array part resize if new_size < L * old_size. + The limit L is expressed as a .3 fixed point value, e.g. 9 means 9/8 = + 112.5% of current size. + + This is rather technical and you should only change the parameter if you've + looked at the internals. diff --git a/config/config-options/DUK_USE_HOBJECT_ARRAY_MINGROW_ADD.yaml b/config/config-options/DUK_USE_HOBJECT_ARRAY_MINGROW_ADD.yaml new file mode 100644 index 00000000..82e79f71 --- /dev/null +++ b/config/config-options/DUK_USE_HOBJECT_ARRAY_MINGROW_ADD.yaml @@ -0,0 +1,8 @@ +define: DUK_USE_HOBJECT_ARRAY_MINGROW_ADD +introduced: 2.1.0 +default: 16 +tags: + - performance +description: > + Technical internal parameter, see sources for details. Only adjust if + you've looked at the internals. diff --git a/config/config-options/DUK_USE_HOBJECT_ARRAY_MINGROW_DIVISOR.yaml b/config/config-options/DUK_USE_HOBJECT_ARRAY_MINGROW_DIVISOR.yaml new file mode 100644 index 00000000..98fdb29f --- /dev/null +++ b/config/config-options/DUK_USE_HOBJECT_ARRAY_MINGROW_DIVISOR.yaml @@ -0,0 +1,8 @@ +define: DUK_USE_HOBJECT_ARRAY_MINGROW_DIVISOR +introduced: 2.1.0 +default: 8 +tags: + - performance +description: > + Technical internal parameter, see sources for details. Only adjust if + you've looked at the internals. diff --git a/config/config-options/DUK_USE_HOBJECT_ENTRY_MINGROW_ADD.yaml b/config/config-options/DUK_USE_HOBJECT_ENTRY_MINGROW_ADD.yaml new file mode 100644 index 00000000..c31b1118 --- /dev/null +++ b/config/config-options/DUK_USE_HOBJECT_ENTRY_MINGROW_ADD.yaml @@ -0,0 +1,8 @@ +define: DUK_USE_HOBJECT_ENTRY_MINGROW_DIVISOR +introduced: 2.1.0 +default: 8 +tags: + - performance +description: > + Technical internal parameter, see sources for details. Only adjust if + you've looked at the internals. diff --git a/config/config-options/DUK_USE_HOBJECT_ENTRY_MINGROW_DIVISOR.yaml b/config/config-options/DUK_USE_HOBJECT_ENTRY_MINGROW_DIVISOR.yaml new file mode 100644 index 00000000..c38fd8f2 --- /dev/null +++ b/config/config-options/DUK_USE_HOBJECT_ENTRY_MINGROW_DIVISOR.yaml @@ -0,0 +1,8 @@ +define: DUK_USE_HOBJECT_ENTRY_MINGROW_ADD +introduced: 2.1.0 +default: 16 +tags: + - performance +description: > + Technical internal parameter, see sources for details. Only adjust if + you've looked at the internals. diff --git a/config/config-options/DUK_USE_HOBJECT_HASH_PART.yaml b/config/config-options/DUK_USE_HOBJECT_HASH_PART.yaml index 16d91de4..4e8c82e9 100644 --- a/config/config-options/DUK_USE_HOBJECT_HASH_PART.yaml +++ b/config/config-options/DUK_USE_HOBJECT_HASH_PART.yaml @@ -9,5 +9,3 @@ description: > enabled unless the target is very low on memory. If DUK_USE_OBJSIZES16 is defined, this option must not be defined. - -# FIXME: expose property limit for hash table as a DUK_USE_xxx flag? diff --git a/config/config-options/DUK_USE_HOBJECT_HASH_PROP_LIMIT.yaml b/config/config-options/DUK_USE_HOBJECT_HASH_PROP_LIMIT.yaml new file mode 100644 index 00000000..008b8361 --- /dev/null +++ b/config/config-options/DUK_USE_HOBJECT_HASH_PROP_LIMIT.yaml @@ -0,0 +1,20 @@ +define: DUK_USE_HOBJECT_HASH_PROP_LIMIT +introduced: 2.1.0 +default: 8 +tags: + - performance + - lowmemory +description: > + Minimum number of properties needed for a hash part to be included in the + object property table. This limit is checked whenever an object is resized. + + A hash part improves property lookup performance even for small objects, + starting from roughly 4 properties. However, this ignores the cost of + setting up and managing the hash part, which is offset only if property + lookups made through the hash part can offset the setup cost. A hash part + is worth it for heavily accessed small objects or large objects (even those + accessed quite infrequently). The limit doesn't take into account property + access frequency, so it is necessarily a compromise. + + A lower value improves performance (a value as low a 4-8 can be useful) + while a higher value conserves memory. diff --git a/config/examples/low_memory.yaml b/config/examples/low_memory.yaml index 649fb41a..fb724195 100644 --- a/config/examples/low_memory.yaml +++ b/config/examples/low_memory.yaml @@ -55,6 +55,10 @@ DUK_USE_STRTAB_RESIZE_CHECK_MASK: 255 # -""- DUK_USE_HSTRING_ARRIDX: false +# Only add a hash table for quite large objects to conserve memory. Even +# lower memory targets usually drop hash part support entirely. +DUK_USE_HOBJECT_HASH_PROP_LIMIT: 64 + # Consider using pointer compression, see doc/low-memory.rst. #DUK_USE_REFCOUNT16: true #DUK_USE_STRHASH16: true