diff options
author | Akio Nakamura <nakamura@dgtechnologies.co.jp> | 2018-02-01 19:34:50 +0900 |
---|---|---|
committer | Akio Nakamura <nakamura@dgtechnologies.co.jp> | 2019-02-03 20:16:27 +0900 |
commit | 86b47fa741408b061ab0bda784b8678bfd7dfa88 (patch) | |
tree | 29b2b5bbc0661cea20133143be3c5536a6ffd922 /src/shutdown.h | |
parent | b3a715301a0fd972fb2f3bd36e2680b3cdbbab26 (diff) |
speed up Unserialize_impl for prevector
The unserializer for prevector uses resize() for reserve the area,
but it's prefer to use reserve() because resize() have overhead
to call its constructor many times.
However, reserve() does not change the value of "_size"
(a private member of prevector).
This PR introduce resize_uninitialized() to prevector that similar to
resize() but does not call constructor, and added elements are
explicitly initialized in Unserialize_imple().
The changes are as follows:
1. prevector.h
Add a public member function named 'resize_uninitialized'.
This function processes like as resize() but does not call constructors.
So added elemensts needs explicitly initialized after this returns.
2. serialize.h
In the following two function:
Unserialize_impl(Stream& is, prevector<N, T>& v, const unsigned char&)
Unserialize_impl(Stream& is, prevector<N, T>& v, const V&)
Calls resize_uninitialized() instead of resize()
3. test/prevector_tests.cpp
Add a test for resize_uninitialized().
Diffstat (limited to 'src/shutdown.h')
0 files changed, 0 insertions, 0 deletions