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:
parent
88738ede30
commit
76a38b6326
@ -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))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user