mapbox / mapnik-vector-tile

Mapnik implemention of Mapbox Vector Tile specification
BSD 3-Clause "New" or "Revised" License
552 stars 117 forks source link

Enable SIMD Instructions for v3.0.x branch #268

Closed flippmoke closed 6 years ago

flippmoke commented 6 years ago

This is similar to #209 but cleaned up. It now wraps the SSE code in a define and fixes some bugs associated with the previous implementation. It has both SSE code for doubles and for floats, based on the size of the container being used.

The previous bugs in #209 were causing slightly different test results, but the test results are the same with this implementation.

This code only changes the performance of the simplification code currently.

Performance Difference:

v3.0.x previous:

./build/Release/vtile-encode ./test/geometry-test-data/benchmark/ginormous-polygon.json 0 0 0 -i 100 -p 4326
z:0 x:0 y:0 iterations:100
5435.11ms (cpu 5419.27ms)   | encode tile: ./test/geometry-test-data/benchmark/ginormous-polygon.json

sse_revised branch:

./build/Release/vtile-encode ./test/geometry-test-data/benchmark/ginormous-polygon.json 0 0 0 -i 100 -p 4326
z:0 x:0 y:0 iterations:100
2941.24ms (cpu 2933.38ms)   | encode tile: ./test/geometry-test-data/benchmark/ginormous-polygon.json
flippmoke commented 6 years ago

Note: This produces slightly different test results in node_mapnik. It is interesting because this is due to a slight change in the processing order of our code. A set of floating point double math was changed from:

A - (C + B) to (A - C) - B

It should be noted that this was using a non-sse code path and compiling with out the SSE_MATH configuration option.

screen shot 2018-02-05 at 1 09 03 pm

Above is the difference this actually produced in the results of simplification.