TL;DR Use ruamel.ordereddict instead of Python's OrderedDict. Significant improvement in memory and CPU usage.
I was having memory issues with w3af
so I started to experiment with different libraries for ordered dicts (since profiling was showing some strange things in that area). These are the results of some memory profiling tests I run:
- Lower memory usage: 11.574 MiB
ruamel.ordereddict
- Higher memory usage: 69.742 MiB SQLMap's ordered dict; almost the same memory usage as the Python's collections.OrderedDict
When running the tests 100 times using timeit this is what I got on my workstation:
- Faster:
ruamel.ordereddict
7.66 seconds