Optimize trkpt sort #15

Closed
opened 2022-10-02 13:01:11 +00:00 by vdv · 2 comments
Owner

For whatever reason, PouchDB does not use indexes parts which are not defined in first position for sorting.

This means that an index on "document type / gpx id / time" would not be used to sort the trkpts for a given gpx id be time (worse than that, this does even raise an exception) and the sort is currently done by the components, for instance in gpx.tsx:

  trkpts.sort((first: any, second: any) =>
    first.trkpt.time.localeCompare(second.trkpt.time)
  );

This is inefficient and slow when there are many track points and this must be optimized.

For whatever reason, PouchDB does *not* use indexes parts which are not defined in first position for sorting. This means that an index on "document type / gpx id / time" would not be used to sort the trkpts for a given gpx id be time (worse than that, this does even raise an exception) and the sort is currently done by the components, for instance in gpx.tsx: ``` trkpts.sort((first: any, second: any) => first.trkpt.time.localeCompare(second.trkpt.time) ); ``` This is inefficient and slow when there are many track points and this must be optimized.
vdv added this to the 22/11 milestone 2022-10-02 13:01:11 +00:00
vdv added the
enhancement
must do
labels 2022-10-02 13:01:11 +00:00
vdv self-assigned this 2022-10-02 13:01:11 +00:00
Author
Owner

An option would be to use and abuse ids and consider using the DocURI library.

An option would be to [use and abuse ids](https://pouchdb.com/2014/06/17/12-pro-tips-for-better-code-with-pouchdb.html) and consider using the [DocURI library](https://pouchdb.com/2014/06/17/12-pro-tips-for-better-code-with-pouchdb.html).
vdv added this to the Use all the possibilities of the GPX format project 2022-10-03 07:02:38 +00:00
vdv referenced this issue from a commit 2022-10-03 09:09:59 +00:00
Author
Owner

Done

Done
vdv closed this issue 2023-03-10 07:20:07 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Dyomedea/dyomedea#15
No description provided.