]> Kevux Git Server - fll/commit
Update: Greatly reduce memory consumption by implementing simple low allocation step.
authorKevin Day <Kevin@kevux.org>
Sun, 4 Aug 2024 06:09:07 +0000 (01:09 -0500)
committerKevin Day <Kevin@kevux.org>
Sun, 4 Aug 2024 20:27:37 +0000 (15:27 -0500)
commit22e79a09c741d3b0bb4bbd1881abe1a9f5de3e81
treeb3c20445df3274307b625000715d2461b5db7aad
parent2c0f62c1226b55b9fb546963e4751bd9c82a245b
Update: Greatly reduce memory consumption by implementing simple low allocation step.

This is the back port of the improvement from the 0.7 development branch.
Adding the macro neither breaks API nor ABI.

Historically the step was always 3.
I found, over time, that increasing the step greatly to something like 128 could greatly reduce memory consumption and performance in many cases.
In the situation where a large number of small objects are allocated then this number like 128 becomes highly abusive.

The simple low allocation step will only allocate a single unit on the very first allocation.
If the next allocation is on an array that has a size greater than one and less than four (via the tiny define), then the step size is set to four during allocation.
If the next allocation is on an array that has a size greater than four and less than eight (via the small define), then the step size is set to eight during allocation.
If the next allocation is on an array that has a size greater than eight and less than sixty-four (via the large define), then the step size is set to sixty-four during allocation.
In all cases, if the request step is less than the calculated step, then the requested step is used.
For example, if the requested step is twelve, then after eight is allocation, then the next generated step size is twelve rather than sixty-four.

Using some test files, shows the following reduction:
- Old: ~8GB of RAM -> New: ~200MB of RAM.
- Old: ~500MB of RAM -> New: ~20MB of RAM.
64 files changed:
build/stand_alone/byte_dump.config.h
build/stand_alone/controller.config.h
build/stand_alone/fake.config.h
build/stand_alone/firewall.config.h
build/stand_alone/fss_basic_list_read.config.h
build/stand_alone/fss_basic_list_write.config.h
build/stand_alone/fss_basic_read.config.h
build/stand_alone/fss_basic_write.config.h
build/stand_alone/fss_extended_list_read.config.h
build/stand_alone/fss_extended_list_write.config.h
build/stand_alone/fss_extended_read.config.h
build/stand_alone/fss_extended_write.config.h
build/stand_alone/fss_identify.config.h
build/stand_alone/fss_payload_read.config.h
build/stand_alone/fss_payload_write.config.h
build/stand_alone/fss_status_code.config.h
build/stand_alone/iki_read.config.h
build/stand_alone/iki_write.config.h
build/stand_alone/status_code.config.h
build/stand_alone/utf8.config.h
level_0/f_fss/c/fss/named.c
level_0/f_fss/c/fss/nest.c
level_0/f_fss/c/fss/set.c
level_0/f_memory/c/memory/common.h
level_0/f_string/c/string/dynamic.c
level_0/f_string/c/string/map.c
level_0/f_string/c/string/map_multi.c
level_0/f_string/c/string/quantity.c
level_0/f_string/c/string/range.c
level_0/f_string/c/string/triple.c
level_0/f_thread/c/thread/attribute.c
level_0/f_thread/c/thread/barrier.c
level_0/f_thread/c/thread/barrier_attribute.c
level_0/f_thread/c/thread/condition.c
level_0/f_thread/c/thread/condition_attribute.c
level_0/f_thread/c/thread/id.c
level_0/f_thread/c/thread/key.c
level_0/f_thread/c/thread/lock.c
level_0/f_thread/c/thread/lock_attribute.c
level_0/f_thread/c/thread/mutex.c
level_0/f_thread/c/thread/mutex_attribute.c
level_0/f_thread/c/thread/once.c
level_0/f_thread/c/thread/semaphore.c
level_0/f_thread/c/thread/set.c
level_0/f_thread/c/thread/spin.c
level_0/f_type_array/c/type_array/array_length.c
level_0/f_type_array/c/type_array/cell.c
level_0/f_type_array/c/type_array/fll_id.c
level_0/f_type_array/c/type_array/int128.c
level_0/f_type_array/c/type_array/int16.c
level_0/f_type_array/c/type_array/int32.c
level_0/f_type_array/c/type_array/int64.c
level_0/f_type_array/c/type_array/int8.c
level_0/f_type_array/c/type_array/state.c
level_0/f_type_array/c/type_array/status.c
level_0/f_type_array/c/type_array/uint128.c
level_0/f_type_array/c/type_array/uint16.c
level_0/f_type_array/c/type_array/uint32.c
level_0/f_type_array/c/type_array/uint64.c
level_0/f_type_array/c/type_array/uint8.c
level_0/f_utf/c/utf/dynamic.c
level_0/f_utf/c/utf/map.c
level_0/f_utf/c/utf/map_multi.c
level_0/f_utf/c/utf/triple.c