Measuring std::memmove speed
I wrote a simple test that outputs std::memmove speed to the console:
AWT_ATTRIBUTE(size_t, element_count, 1000000);
std::unique_ptr<uint8_t> p_src(new uint8_t[element_count]);
std::memset(p_src.get(), 25u, element_count);
std::unique_ptr<uint8_t> p_dst(new uint8_t[element_count]);
context.out << _T("std::memmove: ");
std::memmove(p_dst.get(), p_src.get(), element_count);
ReportSpeed(context, w, element_count);
context.out << std::endl;
And the similar tests for std::memset and std::vector::insert.
Consider the following scenario: there where structure A in an old version of a C++ application:
An instance of A was serialized into a file in a binary format and after that the application was updated to a new version.
But in the new version of the application structure A was modified by adding fields d and e and deleting field a:
and the new version of the application needs to deserialize an instance of its new structure A from the file containing old version of A.
I implemented a simple C++ binary serialization framework that makes a structure or class serializable by adding a macro that usually takes one line of code as shown in the example below:
There is also a macro that makes a structure or a class equatable: