Open seisatsu opened 2 years ago
I should note it is possible if absolutely necessary to change the partitioning scheme of the ESP32 chip so that more space is reserved for the program and less for data storage. You can do this at Tools -> Partition Scheme from the Arduino IDE, or probably from some project settings in ESP-IDF.
I have a low-space-overhead C++ replacement library for vector that we can bring in. I have one for unordered_map, too, but we'd have to test it to see how much space it saves compared to map.
I see that we are also using over 100kb on global variables, which is over 30% of our RAM and seems ludicrous.
For reference, base uLisp uses 22% of our program space and 10% of our RAM. So our overhead has doubled the program space and tripled the RAM usage. I suspect that the third-party C++ STDLib (ArduinoSTL) is a major source of extra beef in our implementation, and we can probably use our knowledge of basic data-structures to reimplement everything in a slightly less pretty fashion but using far less program space and RAM.
I have a low-space-overhead C++ replacement library for vector that we can bring in. I have one for unordered_map, too, but we'd have to test it to see how much space it saves compared to map.
This is good, our maps do not have to be ordered and vectors make life a lot easier, though I was considering using a simple linked list instead. We also will need a low-space-overhead replacement for STD::Pair.
Can you link these libraries in this issue?
If we change the Partition Scheme to "No OTA (2MB APP/2MB FATFS)" we get a lot of extra space to work with. OTA is a piece of firmware that allows flashing the chip over wifi; it takes up a lot of space and we probably don't need it.
Some resources:
I think these are all MIT or BSD licensed.
For pairs I always just make a struct
with two members.
Do our builds pass -O
to GCC to do any optimization? The STDLib functions get massively smaller with even a basic optimization pass.
The vector library that I use for all my new projects is at https://github.com/seisatsu/MalkuthOS/pull/22, although linked-lists might be good, too.
I see that we are also using over 100kb on global variables, which is over 30% of our RAM and seems ludicrous.
Do you think that this could be a sign of static memory allocations (so malloc
doesn't have to be used and memory allocation can't fail)?
The C++ STDLib might be taking up too much space. Over 50% of the program storage space is already taken at this point.