Skip to content

Instantly share code, notes, and snippets.

@jalessio
Last active March 8, 2017 00:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jalessio/7f7a0d73347e51effb11deda3a034f90 to your computer and use it in GitHub Desktop.
Save jalessio/7f7a0d73347e51effb11deda3a034f90 to your computer and use it in GitHub Desktop.
mapbox-vector-tiles shapely "speedups" test

Clone mapbox-vector-tile repo

git clone https://github.com/CalthorpeAnalytics/mapbox-vector-tile.git
git checkout enable-shapely-speedups

Build the Docker image for testing

Copy the Dockerfile in this gist into the directory where you cloned repo then run:

docker build -t mapbox-vector-tiles-dev .

Run benchmark in a Docker container

time docker run --rm -it mapbox-vector-tiles-dev bash -c 'zcat fgeoms.wkt.zip | head -10000 | python bench/bench_encode.py'

NOTE: The Docker image uses Python 3 so it needs the changes for the benchmark script from this PR tilezen/mapbox-vector-tile#90 in order to work.

FROM python:3.5.2
RUN apt-get update && apt-get install -y \
build-essential \
libgeos-dev && \
rm -rf /var/lib/apt/lists/*
# Install Shapely 1.5.x b/c Shapely 1.6.x appears to
# have "speedups" enabled by default
RUN pip install shapely==1.5.17
RUN mkdir -p /code
WORKDIR /code
COPY . /code

master branch (ee6e64c)

  > time docker run --rm -it mapbox-vector-tiles-dev bash -c 'zcat fgeoms.wkt.zip | head -10000 | python bench/bench_encode.py'
  > <snip>
  > Perf result :
  >      14925438 function calls (14876891 primitive calls) in 16.969 seconds
  > <snip>
  > docker run --rm -it mapbox-vector-tiles-dev bash -c   0.04s user 0.02s system 0% cpu 18.769 total

enable-shapely-speedups branch (b339118)

  > time docker run --rm -it mapbox-vector-tiles-dev bash -c 'zcat fgeoms.wkt.zip | head -10000 | python bench/bench_encode.py'
  > <snip>
  > Perf result :
  >     13964306 function calls (13915759 primitive calls) in 14.102 seconds
  > <snip>
  > docker run --rm -it mapbox-vector-tiles-dev bash -c   0.03s user 0.02s system 0% cpu 15.831 total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment