summaryrefslogtreecommitdiff
path: root/view/sharedcache/core/MetadataSerializable.cpp
diff options
context:
space:
mode:
authorMark Rowe <mrowe@bdash.net.nz>2024-11-13 15:48:14 -0800
committerkat <kat@vector35.com>2024-12-10 10:39:14 -0500
commitce88a94adc42807f1cda3b97a7fa8f16320d48a8 (patch)
tree30bd98dc08dff4cf494c202de01fa7d1d0fc0eed /view/sharedcache/core/MetadataSerializable.cpp
parenta371d925e2957c2dd7adf9722a803e7bf7fba4e1 (diff)
[SharedCache] Rework metadata serialization to reduce memory overhead
api/MetadataSerializable.hpp is removed in favor of including core/MetadataSerializable.hpp. Both headers defined types with the same name leading to One Definition Rule violations and surprising behavior. The serialization and deserialization context are now created on-demand during serialization rather than being a member of `MetadataSerializable`. This reduces the size of every serializable object by ~220 bytes. The context is passed explicitly as an argument to `Serialize` / `Deserialize`. As a result, `Serialize` / `Deserialize` can now be free functions rather than member functions. Since `MetadataSerializable` is not used for dynamic dispatch, the virtual methods are removed and the class is updated to be a class template using CRTP. This allows delegating to the derived class's `Load` and `Store` methods without the additional size overhead of the vtable pointer in every serializable object. These changes reduce the memory footprint of Binary Ninja after loading the macOS shared cache and loading a single dylib from it from 8.3GB to 4.6GB.
Diffstat (limited to 'view/sharedcache/core/MetadataSerializable.cpp')
0 files changed, 0 insertions, 0 deletions