diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-04-14 15:21:00 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-04-15 10:24:31 +1200 |
commit | 5729f93e1f512aa9e68b0e01743152aaee2b7c12 (patch) | |
tree | 8fb8486b1fc5e698353b6065ff4124e9ccd45687 /core | |
parent | 1bc977452dc7824ebb86df1c1ba5e14cd0ff83b7 (diff) | |
download | subsurface-5729f93e1f512aa9e68b0e01743152aaee2b7c12.tar.gz |
Undo: don't store insertion index in undo command
When adding dives in an undo command, the index is saved in the
command. This seemed logical at first, because why calculate the
index more than once? But actually it made the code rather subtle
and brittle when multiple dives were added.
Moreover, this is a pointless optimization, as it doesn't optimize
the common case (only one execution).
Remove this for now and calculate the index on every execution. If
it ever turns out to be a bottle neck, it will be much more effective
to turn the linear search of the index into a binary search. A
further sensible optimization would be inserting in batches.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core')
0 files changed, 0 insertions, 0 deletions