More optimal search

The linear search to determine that a just downloaded dive was already
downloaded, started from the oldest dive in the logbook. It is, however
more likely that a just downloaded dive is one of the most recently
downloaded. So, just search backwards. Just a trivial performance
improvement.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
Jan Mulder 2017-05-28 21:25:44 +02:00 committed by Dirk Hohndel
parent 88738ede30
commit 76a38b6326

View file

@ -481,7 +481,7 @@ static int find_dive(struct divecomputer *match)
{
int i;
for (i = 0; i < dive_table.preexisting; i++) {
for (i = dive_table.preexisting - 1; i >= 0; i--) {
struct dive *old = dive_table.dives[i];
if (match_one_dive(match, old))