wc-duck / datalibrary

Open Source Data Library for data serialization.
Other
42 stars 8 forks source link

Fast pointer patching plus txt_unpack for "loaded" data #158

Closed Tisten closed 1 year ago

Tisten commented 1 year ago

For my benchmark test (8,5MB of binary data with a lot of pointers in unions), it used to take 1.92 seconds to patch the pointers on my machine. After this change it takes 0.00056 seconds to do the same thing.

Changing the base address which pointer offsets are calculated from to be the header address instead of the instance root. This means that DL_INSTANCE_VERSION needed to be bumped to 2. There is backwards compatibility added so old data can be read and re-saved.

Also added more CMake rules, to simplify building and testing on other platforms than Windows.

lundmark commented 1 year ago

This looks great 👍

Tisten commented 1 year ago

I should note that the backwards compat is written based on "how it ought to work", and I haven't added proper tests for it. :(

wc-duck commented 1 year ago

Before merging I would like to, at least, discuss "void*" mentioned above.... otherwise consider this merged :)