diff options
| author | Akio Nakamura <[email protected]> | 2017-12-22 19:04:30 +0900 |
|---|---|---|
| committer | Evan Klitzke <[email protected]> | 2018-02-27 11:42:33 -0800 |
| commit | e46be25f0e19d574157752a5c0b674907a1578e6 (patch) | |
| tree | 66d7155ce0b5ffa5e34fdd281dc9314667050307 /src/script/script_error.cpp | |
| parent | Add new prevector benchmarks. (diff) | |
| download | discoin-e46be25f0e19d574157752a5c0b674907a1578e6.tar.xz discoin-e46be25f0e19d574157752a5c0b674907a1578e6.zip | |
Reduce redundant code of prevector and speed it up
In prevector.h, the code which like item_ptr(size()) apears in the loop.
Both item_ptr() and size() judge whether values are held directly or
indirectly, but in most cases it is sufficient to make that judgement
once outside the loop.
This PR adds 2 private function fill() which has the loop to initialize
by specified value (or iterator of the other prevector's element),
but don't call item_ptr() in their loop.
Other functions(assign(), constructor, operator=(), insert())
that has similar loop, call fill() instead of original loop.
Also, resize() was changed like fill(), but it calls the default
constructor for that element each time.
Diffstat (limited to 'src/script/script_error.cpp')
0 files changed, 0 insertions, 0 deletions