Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#28024 closed Cleanup/optimization (fixed)

GEOSCoordSeq performance could be improved significantly by avoiding superfluous checks

Reported by: Sergey Fedoseev Owned by: Sergey Fedoseev
Component: GIS Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

For proof of concept I added reworked tuple version as tuple_fast property.

In [14]: ls = LineString([(x, x) for x in range(1000)])

In [15]: %timeit ls.tuple
10 loops, best of 3: 43.5 ms per loop

In [16]: %timeit ls.tuple_fast
10 loops, best of 3: 16.8 ms per loop

Change History (10)

comment:1 by Sergey Fedoseev, 7 years ago

Owner: changed from nobody to Sergey Fedoseev
Status: newassigned

comment:2 by Tim Graham, 7 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Sergey Fedoseev, 7 years ago

Has patch: set
Version 0, edited 7 years ago by Sergey Fedoseev (next)

comment:4 by Tim Graham, 7 years ago

Triage Stage: AcceptedReady for checkin

comment:5 by Tim Graham <timograham@…>, 7 years ago

In d453dfb1:

Refs #28024 -- Optimized GEOSCoordSeq.tuple by avoiding superfluous index and dimension checks.

comment:6 by Tim Graham <timograham@…>, 7 years ago

In a296a433:

Refs #28024 -- Optimized GEOSCoordSeq.getitem() by avoiding superfluous index and dimension checks.

comment:7 by Tim Graham <timograham@…>, 7 years ago

In ebaa08b3:

Refs #28024 -- Optimized GEOSCoordSeq.setitem() by avoiding superfluous index and dimension checks.

comment:8 by Tim Graham, 7 years ago

Resolution: fixed
Status: assignedclosed

comment:9 by Sergey Fedoseev, 7 years ago

Another related PR for LineString.__init__() optimization.
Benchmark:
python -mtimeit -s "from django.contrib.gis.geos import LineString" "LineString([(x, x) for x in range(1000)])"
31.4 msec => 13.3 msec per loop

Last edited 7 years ago by Sergey Fedoseev (previous) (diff)

comment:10 by Sergey Fedoseev <fedoseev.sergey@…>, 7 years ago

In 6d5bb6a:

Refs #28024 -- Optimized LineString.init() by avoiding superfluous index and dimension checks.

Note: See TracTickets for help on using tickets.
Back to Top