summaryrefslogtreecommitdiff
path: root/src/shared_string.cc
diff options
context:
space:
mode:
authorgeppettodivacin <ericdilmore@gmail.com>2020-02-01 17:24:08 -0600
committergeppettodivacin <ericdilmore@gmail.com>2020-02-02 22:12:18 -0600
commit39a2ab84fa4b537ed8a54d5a32a0ef158f59003e (patch)
tree89e2ba471703fe4955cd2b487ab5099dda341067 /src/shared_string.cc
parent5596b4b2b9dbc56d106f1cd3d3b09ccdcd28ad88 (diff)
Use ReverseView to perform fewer allocations
The first attempt at a bug fix for @ symbols in selection buffer names worked, but it was very inefficient. In particular, it allocated three different vectors, and we really only needed the correct elements. Manipulating iterators to give us the right slices of the existing vector is far more efficient. By reversing the original content and taking the last two, we're able to get the number of selections and main selection without too much hassle. The buffer name is everything from the start of the content to the selection count. This gets us through with only one vector allocation. Credit to @mawww for the optimization idea and for fixing my types.
Diffstat (limited to 'src/shared_string.cc')
0 files changed, 0 insertions, 0 deletions